Inherit from this class to implement logger. More...
#include <kanzi/core/log/abstract_logger.hpp>
Public Member Functions | |
void | write (LogLevel level, string_view levelName, string_view categoryName, string_view fileName, size_t lineNumber, string_view message) |
This function is called by Kanzi to store the message to the log. More... | |
virtual | ~AbstractLogger () |
Destructor. More... | |
Protected Member Functions | |
virtual void | writeOverride (LogLevel level, string_view levelName, string_view categoryName, string_view fileName, size_t lineNumber, string_view message)=0 |
Implement this function in inherited class to store the message to the log. More... | |
Inherit from this class to implement logger.
Your logger class should override writeOverride function. Kanzi invokes writeOverride function when the message is ready to be written to the log. Your implementation of writeOverride function is responsible for final processing and storing of the log message.
The macro kzLog must be used to write the log messages using custom logger. If you want to use custom logger to write all the application log messages then register the logger within Default Logger (see kanzi::DefaultLogger).
There are several loggers implemented. See Default loggers.
To implement logger:
To use logger:
|
inlinevirtual |
Destructor.
|
inline |
This function is called by Kanzi to store the message to the log.
This function calls writeOverride() function implemented in inherited class to store the log message.
level | The log level of the message. |
levelName | The string representation of the log level. |
categoryName | The string representation of the log category. |
fileName | The file name where the log message is originated. |
lineNumber | The line number where the log message is originated. |
message | The log message. |
|
protectedpure virtual |
Implement this function in inherited class to store the message to the log.
It is transparent to Kanzi how this function stores the messages to the log.
level | The log level of the message. |
levelName | The string representation of the log level. |
categoryName | The string representation of the log category. |
fileName | The file name where the log message is originated. |
lineNumber | The line number where the log message is originated. |
message | The log message. |
Implemented in kanzi::detail::StringLogger, kanzi::detail::ChainedLogger, kanzi::CoutLogger, kanzi::Win32DebugLogger, and kanzi::AndroidLogger.