Generic interface to implement a logger.
More...
#include <ILogger.h>
Inherited by libcdoc::ConsoleLogger.
Generic interface to implement a logger.
◆ LogLevel
Log-level enumeration to indicate severity of the log message.
Enumerator |
---|
LEVEL_FATAL | Most critical level. Application is about to abort.
|
LEVEL_ERROR | Errors where functionality has failed or an exception have been caught.
|
LEVEL_WARNING | Warnings about validation issues or temporary failures that can be recovered.
|
LEVEL_INFO | Information that highlights progress or application lifetime events.
|
LEVEL_DEBUG | Debugging the application behavior from internal events of interest.
|
LEVEL_TRACE | Most verbose level. Used for development, NOP in production code.
|
◆ ILogger()
libcdoc::ILogger::ILogger |
( |
| ) |
|
|
inline |
◆ ~ILogger()
virtual libcdoc::ILogger::~ILogger |
( |
| ) |
|
|
inlinevirtual |
◆ addLogger()
static int libcdoc::ILogger::addLogger |
( |
ILogger * |
logger | ) |
|
|
static |
Adds ILogger implementation to logging queue.
This function does not take ownership of the logger's instance. It is up to the caller to free the resources of the logger's instance and keep it alive until removed from the queue.
- Parameters
-
logger | Logger's instance to be added. |
- Returns
- Unique cookie identifying the logger's instance in the logging queue.
◆ getLogger()
static ILogger * libcdoc::ILogger::getLogger |
( |
| ) |
|
|
static |
◆ GetMinLogLevel()
LogLevel libcdoc::ILogger::GetMinLogLevel |
( |
| ) |
const |
|
inlinenoexcept |
Returns current minimum log level of the logger.
- Returns
- Minimum log level.
◆ LogMessage()
virtual void libcdoc::ILogger::LogMessage |
( |
LogLevel |
level, |
|
|
std::string_view |
file, |
|
|
int |
line, |
|
|
std::string_view |
message |
|
) |
| |
|
inlinevirtual |
Logs given message with given severity, file name and line number.
- Parameters
-
level | Severity of the log message. |
file | File name where the log message was recorded. |
line | Line number in the file where the log message was recorded. |
message | The log message. |
Every class implementing the ILogger interface must implement the member function. Default implementation does nothing.
Reimplemented in libcdoc::ConsoleLogger.
Referenced by libcdoc::LogFormat(), and libcdoc::LogFormat().
◆ removeLogger()
static ILogger * libcdoc::ILogger::removeLogger |
( |
int |
cookie | ) |
|
|
static |
Removes logger's instance from the logging queue.
- Parameters
-
cookie | Unique cookie returned by the add_logger function when the logger was added. |
- Returns
- Pointer to ILogger object that is removed. It's up to user to free the resources.
◆ SetMinLogLevel()
void libcdoc::ILogger::SetMinLogLevel |
( |
LogLevel |
level | ) |
|
|
inlinenoexcept |
Sets minimum log level for the logger.
- Parameters
-
level | minimum level to log. |
Sets minimum level of log messages to log. For example, if the minimum log level is set to LogLevelInfo (default), then LogLevelFatal, LogLevelError, LogLevelWarning and LogLevelInfo messages are logged, but not LogLevelDebug or LogLevelTrace messages.
◆ minLogLevel
The documentation for this class was generated from the following file: