Manager for the loggers. More...
Public Member Functions | |
~LoggerManager () | |
Logger & | cout (const std::string &name, log::Level defualtSeverity=log::Level::LEVEL_NOTSET, log::Visibility defualtVisibility=log::VISIBILITY_NOTSET) |
Logger & | cout (log::Level defualtSeverity=log::Level::LEVEL_NOTSET, log::Visibility defualtVisibility=log::VISIBILITY_NOTSET) |
void | create (const std::string &name, bool reset, const std::string &directory, int nProcesses=1, int rank=0) |
void | create (const std::string &name, bool reset=false, int nProcesses=1, int rank=0) |
Logger & | critical (const std::string &name, log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | critical (log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | debug (const std::string &name, log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | debug (log::Visibility visibility=log::VISIBILITY_NOTSET) |
bool | destroy (const std::string &name, bool force=false) |
Logger & | error (const std::string &name, log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | error (log::Visibility visibility=log::VISIBILITY_NOTSET) |
bool | exists (const std::string &name) const |
std::string | getDefaultDirectory () const |
std::string | getDefaultName () const |
log::Mode | getMode () const |
Logger & | info (const std::string &name, log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | info (log::Visibility visibility=log::VISIBILITY_NOTSET) |
void | initialize (log::Mode mode, bool reset, int nProcesses, int rank) |
void | initialize (log::Mode mode, bool reset=false, const std::string &directory=BITPIT_LOG_DIRECTORY, int nProcesses=1, int rank=0) |
void | initialize (log::Mode mode, const std::string &name, bool reset=false, const std::string &directory=BITPIT_LOG_DIRECTORY, int nProcesses=1, int rank=0) |
bool | isInitialized () const |
void | setConsoleVerbosity (log::Level threshold) |
void | setFileVerbosity (log::Level threshold) |
bool | setMode (log::Mode mode) |
void | setVerbosities (log::Level threshold) |
Logger & | warning (const std::string &name, log::Visibility visibility=log::VISIBILITY_NOTSET) |
Logger & | warning (log::Visibility visibility=log::VISIBILITY_NOTSET) |
Static Public Member Functions | |
static LoggerManager & | manager () |
Static Public Attributes | |
static BITPIT_PUBLIC_API std::string | BITPIT_LOG_DIRECTORY = "." |
static BITPIT_PUBLIC_API std::string | BITPIT_LOG_NAME = "bitpit" |
Manager for the loggers.
This class implements a manager for the loggers. The manager allows the different loggers to work together.
Definition at line 233 of file logger.hpp.
bitpit::LoggerManager::~LoggerManager | ( | ) |
Destructor.
Definition at line 972 of file logger.cpp.
Logger & bitpit::LoggerManager::cout | ( | const std::string & | name, |
log::Level | defaultSeverity = log::Level::LEVEL_NOTSET, | ||
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the specified level, if no default severity is specified, the default severity will remain unaltered.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultSeverity | is the default severity of the messages. |
defaultVisibility | is the default visibility of the messages |
Definition at line 1040 of file logger.cpp.
Logger & bitpit::LoggerManager::cout | ( | log::Level | defaultSeverity = log::Level::LEVEL_NOTSET, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of default logger.
The default severity of the messages will be set to the specified level, if no default severity is specified, the default severity will remain unaltered.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultSeverity | is the default severity of the messages. |
defaultVisibility | is the default visibility of the messages |
Definition at line 1016 of file logger.cpp.
void bitpit::LoggerManager::create | ( | const std::string & | name, |
bool | reset, | ||
const std::string & | directory, | ||
int | nProcesses = 1, | ||
int | rank = 0 ) |
Creates a new logger.
name | is the name for the logger |
reset | if true the log files will be reset |
directory | is the directory for saving the log files |
nProcesses | is the total number of processes in the communicator |
rank | is the parallel rank in the communicator |
Definition at line 1342 of file logger.cpp.
void bitpit::LoggerManager::create | ( | const std::string & | name, |
bool | reset = false, | ||
int | nProcesses = 1, | ||
int | rank = 0 ) |
Creates a new logger.
name | is the name for the logger |
reset | if true the log files will be reset |
nProcesses | is the total number of processes in the communicator |
rank | is the parallel rank in the communicator |
Definition at line 1327 of file logger.cpp.
Logger & bitpit::LoggerManager::critical | ( | const std::string & | name, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the CRITICAL level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultVisibility | is the default visibility of the messages |
Definition at line 1103 of file logger.cpp.
Logger & bitpit::LoggerManager::critical | ( | log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET | ) |
Returns an instance of default logger.
The default severity of the messages will be set to the CRITICAL level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultVisibility | is the default visibility of the messages |
Definition at line 1082 of file logger.cpp.
Logger & bitpit::LoggerManager::debug | ( | const std::string & | name, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the DEBUG level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultVisibility | is the default visibility of the messages |
Definition at line 1255 of file logger.cpp.
Logger & bitpit::LoggerManager::debug | ( | log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET | ) |
Returns an instance of default logger.
The default severity of the messages will be set to the DEBUG level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultVisibility | is the default visibility of the messages |
Definition at line 1234 of file logger.cpp.
bool bitpit::LoggerManager::destroy | ( | const std::string & | name, |
bool | force = false ) |
Destroys the specified logger.
The logger can be shared among different users, a logger is destroyed only if it has no users.
name | is the name of the logger |
force | controls if the logger will be destroyed also if it still has users |
Definition at line 1384 of file logger.cpp.
Logger & bitpit::LoggerManager::error | ( | const std::string & | name, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the ERROR level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultVisibility | is the default visibility of the messages |
Definition at line 1141 of file logger.cpp.
Logger & bitpit::LoggerManager::error | ( | log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET | ) |
Returns an instance of default logger.
The default severity of the messages will be set to the ERROR level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultVisibility | is the default visibility of the messages |
Definition at line 1120 of file logger.cpp.
bool bitpit::LoggerManager::exists | ( | const std::string & | name | ) | const |
Check if the specified logger exists.
name | is the name of the logger |
Definition at line 1422 of file logger.cpp.
std::string bitpit::LoggerManager::getDefaultDirectory | ( | ) | const |
Gets the default logger directory.
Definition at line 1603 of file logger.cpp.
std::string bitpit::LoggerManager::getDefaultName | ( | ) | const |
Gets the default logger name.
Definition at line 1593 of file logger.cpp.
log::Mode bitpit::LoggerManager::getMode | ( | ) | const |
Get the operational mode of the logger manager.
Definition at line 1472 of file logger.cpp.
Logger & bitpit::LoggerManager::info | ( | const std::string & | name, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the INFO level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultVisibility | is the default visibility of the messages |
Definition at line 1217 of file logger.cpp.
Logger & bitpit::LoggerManager::info | ( | log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET | ) |
Returns an instance of default logger.
The default severity of the messages will be set to the INFO level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultVisibility | is the default visibility of the messages |
Definition at line 1196 of file logger.cpp.
void bitpit::LoggerManager::initialize | ( | log::Mode | mode, |
bool | reset, | ||
int | nProcesses, | ||
int | rank ) |
Initializes the log manager.
mode | is the mode that will be set |
reset | if true the log files will be reset |
nProcesses | is the total number of processes in the communicator |
rank | is the parallel rank in the communicator |
Definition at line 1268 of file logger.cpp.
void bitpit::LoggerManager::initialize | ( | log::Mode | mode, |
bool | reset = false, | ||
const std::string & | directory = BITPIT_LOG_DIRECTORY, | ||
int | nProcesses = 1, | ||
int | rank = 0 ) |
Initializes the log manager.
mode | is the mode that will be set |
reset | if true the log files will be reset |
directory | is the default directory for saving the log files |
nProcesses | is the total number of processes in the communicator |
rank | is the parallel rank in the communicator |
Definition at line 1283 of file logger.cpp.
void bitpit::LoggerManager::initialize | ( | log::Mode | mode, |
const std::string & | name, | ||
bool | reset = false, | ||
const std::string & | directory = BITPIT_LOG_DIRECTORY, | ||
int | nProcesses = 1, | ||
int | rank = 0 ) |
Initializes the log manager.
mode | is the mode that will be set |
name | is the name for the default logger |
reset | if true the log files will be reset |
directory | is the default directory for saving the log files |
nProcesses | is the total number of processes in the communicator |
rank | is the parallel rank in the communicator |
Definition at line 1299 of file logger.cpp.
bool bitpit::LoggerManager::isInitialized | ( | ) | const |
Checks if the logger manager has been initialized.
Explicit initialization of the manager is done using the function 'initialize', implicit initialization happens the first time a logger is created.
Definition at line 1437 of file logger.cpp.
|
static |
Returns an instance of the logger manager.
Definition at line 992 of file logger.cpp.
void bitpit::LoggerManager::setConsoleVerbosity | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the console.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 1565 of file logger.cpp.
void bitpit::LoggerManager::setFileVerbosity | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the log file.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 1581 of file logger.cpp.
bool bitpit::LoggerManager::setMode | ( | log::Mode | mode | ) |
Set the operational mode of the logger manager.
There are two possible modes:
The mode has to be set before creating the first logger.
mode | is the mode that will be set |
Definition at line 1456 of file logger.cpp.
void bitpit::LoggerManager::setVerbosities | ( | log::Level | threshold | ) |
Sets the verbosity threshold for messages printed on the console and on the log file.
Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.
threshold | is the verbosity threshold |
Definition at line 1549 of file logger.cpp.
Logger & bitpit::LoggerManager::warning | ( | const std::string & | name, |
log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET ) |
Returns an instance of the specified logger.
This function returns an instance of the specified logger. If the logger does not exists a new instance will be created.
The default severity of the messages will be set to the WARNING level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
name | is the name of the logger |
defaultVisibility | is the default visibility of the messages |
Definition at line 1179 of file logger.cpp.
Logger & bitpit::LoggerManager::warning | ( | log::Visibility | defaultVisibility = log::VISIBILITY_NOTSET | ) |
Returns an instance of default logger.
The default severity of the messages will be set to the WARNING level.
The default visibility of the messages will be set to the specified level, if no default visibility is specified, the default visibility will remain unaltered.
defaultVisibility | is the default visibility of the messages |
Definition at line 1158 of file logger.cpp.
|
static |
Definition at line 238 of file logger.hpp.
|
static |
Definition at line 237 of file logger.hpp.