PFASST++
logging.hpp File Reference
#include <iomanip>
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include "pfasst/config.hpp"
#include <pfasst/easylogging++.h>
+ Include dependency graph for logging.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OUT
 Some general variables for coloured terminal output. More...
 

Namespaces

 pfasst
 
 pfasst::log
 Logging facilities for PFASST++.
 

Macros

#define ELPP_STL_LOGGING
 
#define ELPP_NO_DEFAULT_LOG_FILE
 
#define ELPP_LOGGING_FLAGS_FROM_ARG
 
#define ELPP_DEBUG_ASSERT_FAILURE
 
#define ELPP_STACKTRACE_ON_CRASH
 
#define PFASST_LOGGER_INITIALIZED
 Guard symbol to ensure easylogging++ is only initialized once. More...
 
#define PFASST_LOGGER_DEFAULT_GLOBAL_MILLISECOND_WIDTH   "2"
 precision of milliseconds to be printed More...
 
#define VLOG_FUNC_START(scope)
 
#define VLOG_FUNC_END(scope)
 
#define LOG_PRECISION   5
 
#define LOG_INDENT   string(pfasst::log::stack_position * 2, ' ')
 Utility macro for creating identation depending on current stack position. More...
 
#define LOGGER_ID_LENGTH   10
 Length of logger ID to print. More...
 
#define ML_LOG(level, x)   LOG(level) << x
 same as LOG(level, x) from easylogging++ More...
 
#define ML_CLOG(level, logger_id, x)   CLOG(level, logger_id) << x
 same as CLOG(level, logger, x) from easylogging++ More...
 
#define ML_CLOG_IF(condition, level, logger_id, x)   CLOG_IF(condition, level, logger_id) << x
 same as CLOG_IF(condition, level, logger, x) from easylogging++ More...
 
#define ML_CVLOG(verbose_level, logger_id, x)   CVLOG(verbose_level, logger_id) << x
 same as CVLOG(verbosity, logger, x) from easylogging++ More...
 
#define ML_CVLOG_IF(condition, verbose_level, logger_id, x)   CVLOG_IF(condition, verbose_level, logger_id) << x
 same as CVLOG_IF(condition, verbosity, logger, x) from easylogging++ More...
 

Functions

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

Variables

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

Detailed Description

Since
v0.3.0

Logging Macros

The most important and most frequently used logging macros provided by easylogging++ are wrapped in the ML_* macros to avoid the evaluation of string conversion operations when logging is disabled.

Without these wrappers, using the easylogging++ logging macros will lead to evaluation of string operations even with logging disabled at compile time.

Instead of using

LOG(INFO) << "This is a logging line with string conversion " << my_variable;

one should now use

ML_LOG(INFO, "This is a logging line with string conversion " << my_variable);

Definition in file logging.hpp.

Macro Definition Documentation

#define ELPP_DEBUG_ASSERT_FAILURE

Definition at line 92 of file logging.hpp.

#define ELPP_LOGGING_FLAGS_FROM_ARG

Definition at line 89 of file logging.hpp.

#define ELPP_NO_DEFAULT_LOG_FILE

Definition at line 87 of file logging.hpp.

#define ELPP_STACKTRACE_ON_CRASH

Definition at line 93 of file logging.hpp.

#define ELPP_STL_LOGGING

Definition at line 85 of file logging.hpp.

#define LOG_INDENT   string(pfasst::log::stack_position * 2, ' ')

Utility macro for creating identation depending on current stack position.

This uses pfasst::log::stack_position to create a spacing string twice as long.

Definition at line 200 of file logging.hpp.

Referenced by pfasst::examples::boris::ParticleCloud< precision >::distribute_around_center().

#define LOGGER_ID_LENGTH   10

Length of logger ID to print.

Longer logger IDs will usually get cut off.

See also
pfasst::log::add_custom_logger()

Definition at line 210 of file logging.hpp.

Referenced by pfasst::log::add_custom_logger().

#define ML_CLOG_IF (   condition,
  level,
  logger_id,
 
)    CLOG_IF(condition, level, logger_id) << x

same as CLOG_IF(condition, level, logger, x) from easylogging++

See also
Logging Macros

Definition at line 124 of file logging.hpp.

#define ML_CVLOG_IF (   condition,
  verbose_level,
  logger_id,
 
)    CVLOG_IF(condition, verbose_level, logger_id) << x

same as CVLOG_IF(condition, verbosity, logger, x) from easylogging++

See also
Logging Macros

Definition at line 138 of file logging.hpp.

#define PFASST_LOGGER_DEFAULT_GLOBAL_MILLISECOND_WIDTH   "2"

precision of milliseconds to be printed

Definition at line 168 of file logging.hpp.

Referenced by pfasst::log::set_global_logging_options().

#define PFASST_LOGGER_INITIALIZED

Guard symbol to ensure easylogging++ is only initialized once.

When this symbol is defined, it is expected that _INITIALIZE_EASYLOGGINGPP has been called once to initialize easylogging++.

Note
In case the executable using PFASST++ is also using easylogging++ as its logging library and initializing it prior to including the PFASST++ headers, please define this symbol prior including any of the PFASST++ headers.

Definition at line 163 of file logging.hpp.

#define VLOG_FUNC_END (   scope)
Value:
VLOG(9) << std::string(pfasst::log::stack_position * 2, ' ') << "DONE: " << std::string(scope) << "::" << std::string(__func__) << "()";
static size_t stack_position
Definition: logging.hpp:240
Deprecated:
The procedure to use verbose logging this way should be removed in favour of using CVLOG(level, logger) directly.

Definition at line 186 of file logging.hpp.

#define VLOG_FUNC_START (   scope)
Value:
VLOG(9) << std::string((pfasst::log::stack_position - 1) * 2, ' ') << "START: " << std::string(scope) << "::" << std::string(__func__) << "()"
static size_t stack_position
Definition: logging.hpp:240
Deprecated:
The procedure to use verbose logging this way should be removed in favour of using CVLOG(level, logger) directly.

Definition at line 176 of file logging.hpp.

Referenced by pfasst::examples::boris::ParticleCloud< precision >::distribute_around_center().