ChimeraTK-ApplicationCore 04.08.00
Loading...
Searching...
No Matches
ChimeraTK::Logger Class Reference

#include <Logger.h>

Classes

class  Severity
 Severity levels used by the Logger. More...
 
class  StreamProxy
 Proxy for output stream, handed out to the log sources by the Logger::Module. More...
 

Public Member Functions

void setMinSeverity (Severity minSeverity)
 Set the minimum severity level to be passed to the logger.
 
StreamProxy getStream (Severity severity, std::string context)
 Return an output stream object for the given severity.
 
 ~Logger ()
 

Static Public Member Functions

static LoggergetInstance ()
 Obtain global instance of Logger singleton.
 

Friends

class Application
 

Detailed Description

Definition at line 17 of file Logger.h.

Constructor & Destructor Documentation

◆ ~Logger()

ChimeraTK::Logger::~Logger ( )

Definition at line 32 of file Logger.cc.

Member Function Documentation

◆ getInstance()

Logger & ChimeraTK::Logger::getInstance ( )
inlinestatic

Obtain global instance of Logger singleton.

Definition at line 162 of file Logger.h.

◆ getStream()

Logger::StreamProxy ChimeraTK::Logger::getStream ( Logger::Severity  severity,
std::string  context 
)

Return an output stream object for the given severity.

Writing to the stream object will compose the log message locally, if the given severity is above the configured minimum severity (cf. setMinSeverity()). When the stream object is destroyed (i.e. as it goes out of scope) the message will be sent to the logging thread for further processing. The stream object shall not live long, typically each log line will use its own stream object, unless multiple lines shall be sent and printed consistently, in which case "\n" or std::endl can be written to the stream. It is not necessary to terminate the line ("\n" or std::endl) manually before destrying the stream object, since the

If the given severity is below the minimum severity, the stream will be in a failed state and hence writing to the stream will be a no-op (like std::ostream constructed from a nullptr). If data written to the stream is expensive to obtain, it is recommended to check StreamProxy::good() before computing the data.

The given context string will be used to identify the source of the log information.

Note: Consider using the convenience function ChimeraTK::logger() instead of calling this member function directly.

Definition at line 64 of file Logger.cc.

◆ setMinSeverity()

void ChimeraTK::Logger::setMinSeverity ( Severity  minSeverity)
inline

Set the minimum severity level to be passed to the logger.

By default, the minimum severity is set to Severity::info, so that trace and debug messages will not be processed. This will also prevent (to a certain extend) that the message text is composed at sender-side, which improves performance.

Definition at line 60 of file Logger.h.

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

Definition at line 148 of file Logger.h.


The documentation for this class was generated from the following files: