PFASST++
pfasst::log Namespace Reference

Logging facilities for PFASST++. More...

Functions

string format_mpi_rank (const char fill= ' ')
 Formats the local MPI world rank as a string. More...
 
string get_log_file_name ()
 Composes the log file name for the local rank. More...
 
void set_global_logging_options (el::Configurations *conf, const el::Configurations *default_conf=nullptr)
 Sets global logging options. More...
 
static void add_custom_logger (const string &id)
 Provides convenient way of adding additional named loggers. More...
 
static void load_default_config ()
 Sets default configuration for default loggers. More...
 
static void set_logging_flags ()
 Sets some default flags for easylogging++. More...
 
static void test_logging_levels ()
 Prints example logging for all logging levels for the default logger. More...
 
static void start_log (int argc, char **argv)
 Starts easylogging++ with given arguments and loads configuration. More...
 

Variables

static size_t stack_position
 
static bool initialized = false
 internal flag identifying whether the default logger has been initialized. More...
 

Detailed Description

Logging facilities for PFASST++.

As PFASST++ is using easylogging++ as the logging backend, there are six distinced logging levels plus ten additional verbose logging levels.

To achieve consistent logging throughout PFASST++ and its examples, we agree on the following conventions for using the different levels:

  • INFO is used for general important messages to the user
  • DEBUG is ment for developping purposes and is only active when compiled without -DNDEBUG
  • VLOG - the verbose logging levels are used as follows:
See also
easylogging++

Function Documentation

static void pfasst::log::add_custom_logger ( const string &  id)
inlinestatic

Provides convenient way of adding additional named loggers.

With this function one can easily create additional named loggers distinctable by the id. The first LOGGER_ID_LENGTH characters of the ID (as uppercase) will be included in every line of the log. The ID is used in the actual logging calls.

add_custom_logger("MyCustomLogger")
// somewhere else in the code
CLOG(INFO, "MyCustomLogger") << "a logging message";

This results in the log line (for the default value of LOGGER_ID_LENGTH):

<TIME> [MYCUSTOM, INFO ] a logging message

In case MPI is enabled, the line will also contain the MPI rank as given by pfasst::config::get_rank():

<TIME> [MYCUSTOM, INFO , MPI  <rank> ] a logging message
Parameters
[in]idthe ID of the logger; this is used in logging calls
Note
Please make sure to use CLOG (and CVLOG for verbose logging) to be able to specify a specific logger. Otherwise the default logger will be used.
Since
v0.3.0

Definition at line 360 of file logging.hpp.

References OUT::blue, OUT::bold, format_mpi_rank(), pfasst::config::options::get_instance(), pfasst::config::options::get_variables_map(), LOGGER_ID_LENGTH, OUT::magenta, ML_CLOG, OUT::red, OUT::reset, set_global_logging_options(), and OUT::white.

Referenced by pfasst::examples::boris::init_logs(), pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >::init_logs(), load_default_config(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool pfasst::log::initialized = false
static

internal flag identifying whether the default logger has been initialized.

Since
v1.0.0

Definition at line 247 of file logging.hpp.

Referenced by pfasst::config::get_rank(), pfasst::config::options::init(), and load_default_config().

size_t pfasst::log::stack_position
static

Global static helper variable to achieve nested indentation of logging output across different scopes.

Since
v0.3.0

Definition at line 240 of file logging.hpp.

Referenced by start_log().