Tomographer  v5.4
Tomographer C++ Framework Documentation
Tomographer::Logger Namespace Reference

Tomographer's Logging Framework More...

Classes

class  BoostTestLogger
 A logger we can use in tests, which calls BOOST_TEST_MESSAGE() More...
 
class  BufferLogger
 Log messages into an internal memory buffer. More...
 
struct  DefaultLoggerTraits
 Default traits for Logger implementations. More...
 
class  FileLogger
 Simple logger class which logs everything into a given FILE pointer. More...
 
class  LocalLogger
 Local logger: avoid having to repeat origin at each emitted message. More...
 
struct  LocalLoggerOriginSpec
 Tool to specify arguments to LocalLogger. More...
 
class  LoggerBase
 Base logger class. More...
 
struct  LoggerTraits
 Traits template struct to be specialized for specific Logger implementations. More...
 
struct  LoggerTraits< BoostTestLogger >
 
struct  LoggerTraits< BufferLogger >
 Specialized Traits for BufferLogger – see LoggerTraits. More...
 
struct  LoggerTraits< FileLogger >
 Specialized Traits for FileLogger – see LoggerTraits. More...
 
struct  LoggerTraits< LocalLogger< BaseLoggerType_ > >
 Specialized Traits for LocalLogger. See LoggerTraits<BaseLoggerType_> More...
 
struct  LoggerTraits< MinimumSeverityLogger< BaseLogger, Level > >
 Specialized Traits for MinimumSeverityLogger – see LoggerTraits. More...
 
struct  LoggerTraits< MultiProc::CxxThreads::ThreadSanitizerLogger< BaseLogger > >
 Specialized Traits for Tomographer::MultiProc::OMP::ThreadSanitizerLogger<BaseLogger> – see Tomographer::Logger::LoggerTraits<LoggerType> More...
 
struct  LoggerTraits< MultiProc::OMP::ThreadSanitizerLogger< BaseLogger > >
 Specialized Traits for Tomographer::MultiProc::OMP::ThreadSanitizerLogger<typename BaseLogger> – see Tomographer::Logger::LoggerTraits<typename LoggerType> More...
 
struct  LoggerTraits< OriginFilteredLogger< BaseLogger > >
 Specialized Logger Traits for OriginFilteredLogger – see LoggerTraits. More...
 
struct  LoggerTraits< OriginPrefixedLogger< BaseLogger > >
 Specialized Traits for OriginPrefixedLogger – see LoggerTraits. More...
 
struct  LoggerTraits< tpy::GilProtectedPyLogger >
 
struct  LoggerTraits< tpy::PyLogger >
 
struct  LoggerTraits< VacuumLogger >
 Specialied Traits for VacuumLogger. See LoggerTraits<BaseLogger>. More...
 
class  LogLevel
 Object which stores a log level and can initialize from a string. More...
 
class  MinimumSeverityLogger
 Logger which statically discards any messages less important than a fixed severity. More...
 
class  OriginFilteredLogger
 A logger which filters entries according to where they originated from. More...
 
class  OriginPrefixedLogger
 Logger which prepends to each origin string a fixed prefix. More...
 
struct  StaticIsAtLeastOfSeverity
 Helper for statically determining if Level is at least as severe as BaseLevel. More...
 
class  VacuumLogger
 Logger that discards all messages. More...
 

Enumerations

enum  LogLevelCode
 Possible logging levels. More...
 

Functions

std::istreamoperator>> (std::istream &str, LogLevel &l)
 C++ input stream operator for LogLevel.
 
std::ostreamoperator<< (std::ostream &str, const LogLevel &l)
 C++ output stream operator for LogLevel.
 
bool isAtLeastOfSeverity (int level, int baselevel)
 Helper to compare severity levels. More...
 
template<typename BaseLoggerType >
LocalLogger< BaseLoggerType > makeLocalLogger (std::string origin_fn_name, BaseLoggerType &baselogger)
 Create a local logger. More...
 
template<typename BaseLoggerType >
LocalLogger< BaseLoggerType > makeLocalLogger (std::string origin_prefix, std::string glue, BaseLoggerType &baselogger)
 Create a local logger. More...
 
template<typename BaseLoggerType >
LocalLogger< BaseLoggerType > makeLocalLogger (const LocalLoggerOriginSpec &spec, BaseLoggerType &baselogger)
 Create a local logger. More...
 

Detailed Description

Tomographer's Logging Framework

Enumeration Type Documentation

§ LogLevelCode

Possible logging levels.

Don't trust the numeric values here, they may change at any time. Just the order is important.

Enumerator
ERROR 

Error logging level.

A log message with this level signifies that a critical error has occurred which prevents further processing. The program is about to terminate.

WARNING 

Warning logging level.

A log message with this level signifies a warning for the user. The computation may continue, but most likely the user provided erroneous input, a routine may have failed to reach the required precision, or there are features which will not be available.

INFO 

Information logging level.

Log messages with the INFO level are general messages which inform the user about the global steps being taken. They may indicate, for example, what will be computed.

DEBUG 

Debug logging level.

More verbose information, meant to debug either the input data or the Tomographer program itself. These messages should make it easier to locate a specific error, and generally give a more specific idea of what the program does.

The DEBUG level is meant to still be readable on a terminal output (with decent scrollback), even with multiple threads. Don't generate too many messages with this level. Use the LONGDEBUG level to generate as many messages as you want.

LONGDEBUG 

Long Debug logging level.

This level is meant to signify very specific messages, such as infomation about individual iterations. The log produced with this level may be very long an no longer readable on a terminal.

Use this level for messages that are generated very often.

HIGHEST_SEVERITY_LEVEL 

Highest severity possible.

Don't use as a level. Use, rather, as value e.g. for LoggerTraits::StaticMinimumSeverityLevel.

LOWEST_SEVERITY_LEVEL 

Lowest severity possible.

Don't use as a level. Use, rather, as value e.g. for LoggerTraits::StaticMinimumSeverityLevel.

Definition at line 76 of file loggers.h.

Function Documentation

§ isAtLeastOfSeverity()

bool Tomographer::Logger::isAtLeastOfSeverity ( int  level,
int  baselevel 
)
inline

Helper to compare severity levels.

Returns true if the given level is at least as severe (equal severity or higher severity) as baselevel (for example, if level == Logger::ERROR and baselevel == Logger::INFO).

Just to make sure we don't confuse the numerical ordering of the levels, we should always use this helper function to see whether a level is at least of a given severity.

Definition at line 248 of file loggers.h.

§ makeLocalLogger() [1/3]

template<typename BaseLoggerType >
LocalLogger<BaseLoggerType> Tomographer::Logger::makeLocalLogger ( std::string  origin_fn_name,
BaseLoggerType &  baselogger 
)
inline

Create a local logger.

This function is useful to avoid having to repeat the base logger's type, by using C++'s auto keyword as well as automatic template argument deduction:

auto logger = makeLocalLogger(TOMO_ORIGIN, baselogger);

The above code is equivalent to

LocalLogger<decltype(baselogger)> logger(TOMO_ORIGIN, baselogger);

Each overload of makeLocalLogger() calls the matching LocalLogger constructor. As in the example above, you may use TOMO_ORIGIN as the origin argument.

Definition at line 2040 of file loggers.h.

§ makeLocalLogger() [2/3]

template<typename BaseLoggerType >
LocalLogger<BaseLoggerType> Tomographer::Logger::makeLocalLogger ( std::string  origin_prefix,
std::string  glue,
BaseLoggerType &  baselogger 
)
inline

Create a local logger.

This function overload provides the same functionality as makeLocalLogger(std::string,BaseLoggerType&), but simply calls the other corresponding constructor.

Definition at line 2053 of file loggers.h.

§ makeLocalLogger() [3/3]

template<typename BaseLoggerType >
LocalLogger<BaseLoggerType> Tomographer::Logger::makeLocalLogger ( const LocalLoggerOriginSpec spec,
BaseLoggerType &  baselogger 
)
inline

Create a local logger.

This function overload provides the same functionality as makeLocalLogger(std::string,BaseLoggerType&), but simply calls the other corresponding constructor.

Definition at line 2066 of file loggers.h.