walberla::logging Namespace Reference

Namespaces

 internal
 

Classes

class  Logging
 
class  Tracer
 Tracer printing a log message upon creation and destruction. More...
 

Functions

static void parseIgnoreBlocks (const Config::Blocks &ignoreBlocks, std::vector< walberla::regex > &regexes)
 
void configureLogging (const shared_ptr< Config > &config)
 Function for initializing the logging singleton from file. More...
 
void configureLogging (const Config::BlockHandle &loggingBlock)
 

Function Documentation

void walberla::logging::configureLogging ( const shared_ptr< Config > &  config)

Function for initializing the logging singleton from file.

This initialization function reads data stored in a configuration file and uses thi data to configure the logging singleton. The structure of the configuration file which is recognized by this function must look like as follows:

Logging { // the whole 'Logging' block is optional
logLevel warning|info|progress|detail|tracing; // optional, default=info
streamLogLevel warning|info|progress|detail|tracing; // optional, default=info
fileLogLevel warning|info|progress|detail|tracing; // optional, default=info
logfile [filename]; // optional, default=no logfiles are created, logging only uses stdout & stderr
append true|false; // optional, only valid if 'logfile' is provided, default=false
time true|false; // optional, default=true
logCallerPath true|false; // optional, default=false
ignore { callerPathPattern [regex]; } // optional
ignore { callerPathPattern [regex]; }
ignore ...
ignoreWarning { callerPathPattern [regex]; } // optional
ignoreWarning { callerPathPattern [regex]; }
ignoreWarning ...
} // Logging

Ignoring of log messages:

Log messages can be ignored by specifying a regular expression on the filename and line number of the source file the log message originates from. The regex has to be specified in an ignore block as the parameter callerPathPattern. If the regular expression is found somewhere in the string <filename>:<line number>="">, the log message is ignored. To divide components of your path always uses slashes! They will automatically be converted to the regex (/|\), matching slashes and back-slashes. For fancy regexes you can use perl regex syntax. To ignore warnings use the spcecial ignoreWarning block. Note that you cannot ignore Errors since they abort your program!

Examples: ignore { callerPathPattern /src/core/; } // ignores log messages from core ignore { callerPathPattern /src/vtk/; } // ignores log messages from vtk ignore { callerPathPattern (/src/core/|/src/vtk/); } // ignores log messages from core & vtk ignore { callerPathPattern /src/core/FILENAME.h:416; } // ignores a specific log message ignoreWarning { callerPathPattern /src/core/FILENAME.h:212; } // ignores a specific warning

Parameters
configThe configuration
void walberla::logging::configureLogging ( const Config::BlockHandle &  loggingBlock)
static void walberla::logging::parseIgnoreBlocks ( const Config::Blocks &  ignoreBlocks,
std::vector< walberla::regex > &  regexes 
)
static