UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
util::log::ILogger Class Referenceabstract

Interface against a generic logger. More...

#include "util/ilogger.h"

Public Member Functions

virtual ~ILogger ()=default
 Destructor.
virtual void AddLogMessage (const LogMessage &message)=0
 Handle a log message.
virtual void Stop ()
 Stops any worker thread.
void EnableSeverityLevel (LogSeverity severity, bool enable)
 Enable or disable a severity.
bool IsSeverityLevelEnabled (LogSeverity severity) const
 Checks if a level is enabled or disabled.
void ShowLocation (bool show)
 Enable or disable the source location information.
bool ShowLocation () const
 Returns true if the source location should be shown.
virtual bool HasLogFile () const
 Returns true if the logger has file.
virtual std::string Filename () const
 Return full path to the log file.

Protected Member Functions

 ILogger ()=default
 Constructor.

Detailed Description

The class is an interface class for implementing a logger. Its main interface is the AddLogMessage() function that handles incoming log messages.

Member Function Documentation

◆ EnableSeverityLevel()

void util::log::ILogger::EnableSeverityLevel ( LogSeverity severity,
bool enable )

Enables or disable a log severity. By default all log messages are shown but some logger type may disable some severity messages. Typical is the trace level disabled. Disable a severity level means that it isn't saved or sent further by this logger.

Parameters
severitySeverity Level
enableTrue to enable, false to disable.

◆ IsSeverityLevelEnabled()

bool util::log::ILogger::IsSeverityLevelEnabled ( LogSeverity severity) const
nodiscard

Checks if a severity level is enabled or disabled. If it is disbaled, the message should not be dropped by the logger.

Parameters
severitySeverity Level
Returns
True if enabled or false if disabled.

◆ ShowLocation() [1/2]

bool util::log::ILogger::ShowLocation ( ) const
inlinenodiscard

Return true if the source location should be included by the logger.

Returns
True if source location should be included.

◆ ShowLocation() [2/2]

void util::log::ILogger::ShowLocation ( bool show)
inline

The source location normally appended to the log message. It logs the file, function, line and column where the message was generated. For some loggers, this information is not needed.

Parameters
showTrue if the source location should be stored.

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