AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slic Namespace Reference

Namespaces

 detail
 
 inherit
 
 message
 

Classes

struct  debug
 
class  GenericOutputStream
 Concrete instance of LogStream, which implements functionality for logging messages to a C++ ostream object, e.g., std::cout, std::cerr, a std::ofstream, std::ostringstream, etc. More...
 
class  Logger
 A singleton class for logging error, debug and warning messages. More...
 
class  LogStream
 Abstract base class defining the interface of all LogStreams. More...
 
class  LumberjackStream
 A concrete instance of LogStream that utilizes Lumberjack to filter and pass messages between MPI nodes. More...
 
class  SimpleLogger
 SimpleLogger is a simple wrapper around the initialization and finalize operations of the slic::Logger class that is helpful for unit tests and simple applications in axom. More...
 
class  SynchronizedStream
 A concrete instance of LogStream that dumps messages to a C++ std::ostream object. More...
 

Typedefs

using AbortFunctionPtr = void(*)()
 

Functions

void initialize ()
 Initializes the SLIC logging environment. More...
 
bool isInitialized ()
 Checks if the SLIC logging environment is initialized. More...
 
void createLogger (const std::string &name, char imask=inherit::nothing)
 Creates a new logger associated with the given name. More...
 
bool activateLogger (const std::string &name)
 Activates the logger associated with the given name. More...
 
std::string getActiveLoggerName ()
 Returns the name of the active logger. More...
 
void setLoggingMsgLevel (message::Level level)
 Sets desired logging level. More...
 
message::Level getLoggingMsgLevel ()
 Gets the current logging level. More...
 
void setAbortOnError (bool status)
 Toggles the abort behavior for errors on the current active logger. More...
 
void enableAbortOnError ()
 Enables aborts on error messages for the current active logger. More...
 
void disableAbortOnError ()
 Disables aborts on error messages for the current active logger. More...
 
bool isAbortOnErrorsEnabled ()
 Checks whether aborts on errors are enabled for the current logger. More...
 
void setAbortOnWarning (bool status)
 Toggles the abort behavior for warnings on the current active logger. More...
 
void enableAbortOnWarning ()
 Enables aborts on warnings messages for the current active logger. More...
 
void disableAbortOnWarning ()
 Disables aborts on warnings messages for the current active logger. More...
 
bool isAbortOnWarningsEnabled ()
 Checks whether aborts on warnings are enabled for the current logger. More...
 
void setAbortFunction (AbortFunctionPtr abort_func)
 Sets the function to call when program abort is requested. More...
 
void addStreamToMsgLevel (LogStream *ls, message::Level level)
 Adds the given stream to the the given level. More...
 
void addStreamToAllMsgLevels (LogStream *ls)
 Adds the given stream to all levels. 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 &tag, 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 &tag, const std::string &fileName, int line, bool filter_duplicates=false)
 Logs the given message to all registered streams. More...
 
void logErrorMessage (const std::string &message, const std::string &fileName, int line)
 Convenience method to log an error message. More...
 
void logWarningMessage (const std::string &message, const std::string &fileName, int line)
 Convenience method to log warning messages. More...
 
void flushStreams ()
 Flushes all streams. More...
 
void pushStreams ()
 Pushes all streams. More...
 
void finalize ()
 Finalizes the slic logging environment. More...
 
std::string stacktrace ()
 Uses glibc's backtrace() functionality to return a stacktrace. More...
 

Typedef Documentation

◆ AbortFunctionPtr

using axom::slic::AbortFunctionPtr = typedef void (*)()

Function Documentation

◆ initialize()

◆ isInitialized()

bool axom::slic::isInitialized ( )

Checks if the SLIC logging environment is initialized.

Returns
status true if initialized, else, false.

◆ createLogger()

void axom::slic::createLogger ( const std::string &  name,
char  imask = inherit::nothing 
)

Creates a new logger associated with the given name.

Parameters
[in]namethe name to associate with the new logger.
[in]imaskinheritance mask, indicates the log level streams that will be inherited from the "root" logger. By default, nothing is inherited.

◆ activateLogger()

bool axom::slic::activateLogger ( const std::string &  name)

Activates the logger associated with the given name.

Parameters
[in]namethe name of the logger to activate.
Returns
True if the named logger was activated, False otherwise

◆ getActiveLoggerName()

std::string axom::slic::getActiveLoggerName ( )

Returns the name of the active logger.

Returns
s a string corresponding to the name of the active logger.

◆ setLoggingMsgLevel()

void axom::slic::setLoggingMsgLevel ( message::Level  level)

Sets desired logging level.

Parameters
[in]leveluser-supplied level to log.

Referenced by axom::slic::SimpleLogger::SimpleLogger().

◆ getLoggingMsgLevel()

message::Level axom::slic::getLoggingMsgLevel ( )

Gets the current logging level.

◆ setAbortOnError()

void axom::slic::setAbortOnError ( bool  status)

Toggles the abort behavior for errors on the current active logger.

Parameters
[in]statususer-supplied flag.

◆ enableAbortOnError()

void axom::slic::enableAbortOnError ( )

Enables aborts on error messages for the current active logger.

Note
This is equivalent to calling slic::setAbortOnError( true )
Postcondition
slic::isAbortOnErrorsEnabled() == true.
Precondition
slic::isInitialized() == true

◆ disableAbortOnError()

void axom::slic::disableAbortOnError ( )

Disables aborts on error messages for the current active logger.

Note
this is equivalent to calling slic::setAbortOnError( false )
Postcondition
slic::isAbortOnErrorsEnabled() == false.
Precondition
slic::isInitialized() == true

◆ isAbortOnErrorsEnabled()

bool axom::slic::isAbortOnErrorsEnabled ( )

Checks whether aborts on errors are enabled for the current logger.

Returns
status true if aborts on errors are enabled, otherwise, false.
Precondition
slic::isInitialized() == true.

◆ setAbortOnWarning()

void axom::slic::setAbortOnWarning ( bool  status)

Toggles the abort behavior for warnings on the current active logger.

Parameters
[in]statususer-supplied flag.

◆ enableAbortOnWarning()

void axom::slic::enableAbortOnWarning ( )

Enables aborts on warnings messages for the current active logger.

Note
This is equivalent to calling slic::setAbortOnWarning( true )
Postcondition
slic::isAbortOnWarningsEnabled() == true.
Precondition
slic::isInitialized() == true.

◆ disableAbortOnWarning()

void axom::slic::disableAbortOnWarning ( )

Disables aborts on warnings messages for the current active logger.

Note
This is equivalent to calling slic::setAbortOnWarnings( false )
Postcondition
slic::isAbortOnWarnigsEnabled() == true.
Precondition
slic::isInitialized() == true.

◆ isAbortOnWarningsEnabled()

bool axom::slic::isAbortOnWarningsEnabled ( )

Checks whether aborts on warnings are enabled for the current logger.

Returns
status true if aborts on warnings are enabled, otherwise, false.
Precondition
slic::isInitialized() == true.

◆ setAbortFunction()

void axom::slic::setAbortFunction ( AbortFunctionPtr  abort_func)

Sets the function to call when program abort is requested.

Parameters
[in]abort_funcThe user-specified function to call
Precondition
slic::isInitialized() == true.

◆ addStreamToMsgLevel()

void axom::slic::addStreamToMsgLevel ( LogStream ls,
message::Level  level 
)

Adds the given stream to the the given level.

Parameters
[in]lspointer to the log stream.
[in]levelthe level to log.
Precondition
ls != nullptr

Referenced by axom::slic::SimpleLogger::SimpleLogger().

◆ addStreamToAllMsgLevels()

void axom::slic::addStreamToAllMsgLevels ( LogStream ls)

Adds the given stream to all levels.

Parameters
[in]lspointer to the log stream.
Precondition
ls != nullptr.

◆ logMessage() [1/4]

void axom::slic::logMessage ( message::Level  level,
const std::string &  message,
bool  filter_duplicates = false 
)

Logs the given message to all registered streams.

Parameters
[in]levelthe level of the message being logged.
[in]messageuser-supplied message.
[in]filter_duplicatesoptional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false.

◆ logMessage() [2/4]

void axom::slic::logMessage ( message::Level  level,
const std::string &  message,
const std::string &  tag,
bool  filter_duplicates = false 
)

Logs the given message to all registered streams.

Parameters
[in]levelthe level of the message being logged.
[in]messageuser-supplied message.
[in]taguser-supplied associated with this message.
[in]filter_duplicatesoptional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false.

◆ logMessage() [3/4]

void axom::slic::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.

Parameters
[in]levelthe level of the message being logged.
[in]messageuser-supplied message.
[in]fileNamethe name of the file this message is logged from.
[in]linethe line number within the file this message is logged.
[in]filter_duplicatesoptional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false.

◆ logMessage() [4/4]

void axom::slic::logMessage ( message::Level  level,
const std::string &  message,
const std::string &  tag,
const std::string &  fileName,
int  line,
bool  filter_duplicates = false 
)

Logs the given message to all registered streams.

Parameters
[in]levelthe level of the message being logged.
[in]messageuser-supplied message.
[in]taguser-supplied tag associated with the message.
[in]fileNamethe name of the file this message is logged form.
[in]linethe line number within the file this message is logged.
[in]filter_duplicatesoptional parameter that indicates whether duplicate messages resulting from running in parallel will be filtered out. Default is false.

◆ logErrorMessage()

void axom::slic::logErrorMessage ( const std::string &  message,
const std::string &  fileName,
int  line 
)

Convenience method to log an error message.

Parameters
[in]messageuser-supplied message.
[in]fileNamethe name of the file this message is logged from.
[in]linethe line number within the file that the message is logged.

◆ logWarningMessage()

void axom::slic::logWarningMessage ( const std::string &  message,
const std::string &  fileName,
int  line 
)

Convenience method to log warning messages.

Parameters
[in]messageuser-supplied message.
[in]fileNamethe name of the file this message is logged from.
[in]linethe line number within the file that the message is logged.

◆ flushStreams()

void axom::slic::flushStreams ( )

Flushes all streams.

See also
Logger::flushStreams.

◆ pushStreams()

void axom::slic::pushStreams ( )

Pushes all streams.

See also
Logger::pushStreams.

◆ finalize()

void axom::slic::finalize ( )

Finalizes the slic logging environment.

Referenced by axom::slic::SimpleLogger::~SimpleLogger().

◆ stacktrace()

std::string axom::slic::stacktrace ( )

Uses glibc's backtrace() functionality to return a stacktrace.

Returns
s a string corresponding to the stacktrace.