AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
A singleton class for logging error, debug and warning messages. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.6.0/src/axom/slic/core/Logger.hpp>
Public Member Functions | |
message::Level | getLoggingMsgLevel () |
Gets the currently set logging level. More... | |
void | setLoggingMsgLevel (message::Level level) |
Sets the logging level to the given level. This controls which messages are logged based on severity. All messages with equal or higher severity to the given level will be logged. More... | |
void | setAbortOnError (bool status) |
Toggles the abort behavior for error messages. Default is false. More... | |
void | enableAbortOnError () |
Enables abort on error messages. More... | |
void | disableAbortOnError () |
Disables abort on error messages. More... | |
bool | isAbortOnErrorsEnabled () const |
Checks the status of the abort behavior on error messages. More... | |
void | setAbortOnWarning (bool status) |
Toggles the abort behavior for warning messages. Default is false. More... | |
void | enableAbortOnWarning () |
Enables abort on warning messages. More... | |
void | disableAbortOnWarning () |
Disables abort on warnings messages. More... | |
bool | isAbortOnWarningsEnabled () const |
Checks the status of the abort behavior on warning messages. More... | |
void | setAbortFunction (AbortFunctionPtr abort_func) |
Sets the function to call when program abort is requested. More... | |
std::string | getName () const |
Returns the name of this logger instance. More... | |
void | addStreamToMsgLevel (LogStream *ls, message::Level level, bool pass_ownership=true) |
Binds the given stream to the given level for this Logger instance. More... | |
void | addStreamToAllMsgLevels (LogStream *ls) |
Binds the given stream to all the levels for this Logger instance. More... | |
int | getNumStreamsAtMsgLevel (message::Level level) |
Returns the number of streams at the given level. More... | |
LogStream * | getStream (message::Level level, int i) |
Returns the ith stream at the given level. More... | |
void | logMessage (message::Level level, const std::string &message, bool filter_duplicates=false) |
Logs the given message to all registered streams. More... | |
void | logMessage (message::Level level, const std::string &message, const std::string &tagName, bool filter_duplicates=false) |
Logs the given message to all registered streams. More... | |
void | logMessage (message::Level level, const std::string &message, const std::string &fileName, int line, bool filter_duplicates=false) |
Logs the given message to all registered streams. More... | |
void | logMessage (message::Level level, const std::string &message, const std::string &tagName, const std::string &fileName, int line, bool filter_duplicates=false) |
Logs the given message to all registered streams. More... | |
void | flushStreams () |
Flushes all streams. More... | |
void | pushStreams () |
Pushes messages incrementally up all streams. More... | |
Static Public Member Functions | |
Static Methods | |
static void | initialize () |
Initializes the logging environment, with the root logger. More... | |
static bool | createLogger (const std::string &name, char imask=inherit::nothing) |
Creates a new logger associated with the given name. More... | |
static bool | activateLogger (const std::string &name) |
Activates the logger with the associate name. More... | |
static void | finalize () |
Finalizes the logging environment. More... | |
static std::string | getActiveLoggerName () |
Returns the name of the currently active logger instance. More... | |
static Logger * | getActiveLogger () |
Returns a pointer to the logger instance. More... | |
static Logger * | getRootLogger () |
Returns the root logger. More... | |
A singleton class for logging error, debug and warning messages.
Applications using this logging facility must call initialize() and finalize(), typically in the beginning and end of the application's main() respectively. Logging messages can then be accomplished through calls to 'logMessage(type,msg,file,line)' or through the convenience macro layer, which allows for logging messages to be compiled out.
The Logger appends the messages to the set of registered LogStreams. Messages are logged using the LogStream abstraction layer. This allows an application to use some of the predefined LogStream mechanisms or implement a custom one by implementing a derivative of the LogStream class.
message::Level axom::slic::Logger::getLoggingMsgLevel | ( | ) |
Gets the currently set logging level.
void axom::slic::Logger::setLoggingMsgLevel | ( | message::Level | level | ) |
Sets the logging level to the given level. This controls which messages are logged based on severity. All messages with equal or higher severity to the given level will be logged.
[in] | level | the logging level. |
|
inline |
Toggles the abort behavior for error messages. Default is false.
[in] | status | user-supplied flag. |
|
inline |
Enables abort on error messages.
|
inline |
Disables abort on error messages.
|
inline |
Checks the status of the abort behavior on error messages.
|
inline |
Toggles the abort behavior for warning messages. Default is false.
[in] | status | user-supplied flag. |
|
inline |
Enables abort on warning messages.
|
inline |
Disables abort on warnings messages.
|
inline |
Checks the status of the abort behavior on warning messages.
References setAbortFunction().
void axom::slic::Logger::setAbortFunction | ( | AbortFunctionPtr | abort_func | ) |
Sets the function to call when program abort is requested.
[in] | abort_func | The user-specified function to call |
Referenced by isAbortOnWarningsEnabled().
|
inline |
Returns the name of this logger instance.
References activateLogger(), addStreamToAllMsgLevels(), addStreamToMsgLevel(), createLogger(), finalize(), flushStreams(), getActiveLogger(), getActiveLoggerName(), getNumStreamsAtMsgLevel(), getRootLogger(), getStream(), initialize(), logMessage(), axom::slic::inherit::nothing, axom::slic::message::Num_Levels, and pushStreams().
void axom::slic::Logger::addStreamToMsgLevel | ( | LogStream * | ls, |
message::Level | level, | ||
bool | pass_ownership = true |
||
) |
Binds the given stream to the given level for this Logger instance.
[in] | ls | pointer to the user-supplied LogStream object. |
[in] | level | the level that this stream will be associated with. |
[in] | pass_ownership | flag that indicates whether the given logger instance owns the supplied LogStream object. This parameter is optional. Default is true. |
Referenced by getName().
void axom::slic::Logger::addStreamToAllMsgLevels | ( | LogStream * | ls | ) |
int axom::slic::Logger::getNumStreamsAtMsgLevel | ( | message::Level | level | ) |
Returns the number of streams at the given level.
[in] | level | the level in query. |
Referenced by getName().
LogStream* axom::slic::Logger::getStream | ( | message::Level | level, |
int | i | ||
) |
Returns the ith stream at the given level.
[in] | level | the level in query. |
[in] | i | the index of the stream in query. |
Referenced by getName().
void axom::slic::Logger::logMessage | ( | message::Level | level, |
const std::string & | message, | ||
bool | filter_duplicates = false |
||
) |
Logs the given message to all registered streams.
[in] | level | the level of the given message. |
[in] | message | the user-supplied message to log. |
[in] | filter_duplicates | optional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false. |
Referenced by getName().
void axom::slic::Logger::logMessage | ( | message::Level | level, |
const std::string & | message, | ||
const std::string & | tagName, | ||
bool | filter_duplicates = false |
||
) |
Logs the given message to all registered streams.
[in] | level | the level of the given message. |
[in] | message | the user-supplied message to log. |
[in] | tagName | user-supplied tag to associated with the given message. |
[in] | filter_duplicates | optional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false. |
void axom::slic::Logger::logMessage | ( | message::Level | level, |
const std::string & | message, | ||
const std::string & | fileName, | ||
int | line, | ||
bool | filter_duplicates = false |
||
) |
Logs the given message to all registered streams.
[in] | level | the level of the given message. |
[in] | message | the user-supplied message to log. |
[in] | fileName | name of the file this call is made from. |
[in] | line | line within the file that this call is made from. |
[in] | filter_duplicates | optional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false. |
void axom::slic::Logger::logMessage | ( | message::Level | level, |
const std::string & | message, | ||
const std::string & | tagName, | ||
const std::string & | fileName, | ||
int | line, | ||
bool | filter_duplicates = false |
||
) |
Logs the given message to all registered streams.
[in] | level | the level of the given message. |
[in] | message | the user-supplied message to log. |
[in] | tagName | user-supplied tag to associated with the given message. |
[in] | fileName | name of the file this call is made from. |
[in] | line | line within the file that this call is made from. |
[in] | filter_duplicates | optional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false. |
void axom::slic::Logger::flushStreams | ( | ) |
Flushes all streams.
Referenced by getName().
void axom::slic::Logger::pushStreams | ( | ) |
Pushes messages incrementally up all streams.
Referenced by getName().
|
static |
Initializes the logging environment, with the root logger.
Referenced by getName().
|
static |
Creates a new logger associated with the given name.
[in] | name | the name to associate with the new logger. |
[in] | imask | inheritance mask, indicates the log level(s), which will be inherited from the "root" logger. By default, nothing is inherited. |
Referenced by getName().
|
static |
Activates the logger with the associate name.
[in] | name | the name of the logger to activate. |
Referenced by getName().
|
static |
Finalizes the logging environment.
Referenced by getName().
|
static |
Returns the name of the currently active logger instance.
Referenced by getName().
|
static |
Returns a pointer to the logger instance.
Referenced by getName().
|
static |
Returns the root logger.
Referenced by getName().