Tkrzw
|
Interface for logging operations. More...
#include <tkrzw_logger.h>
Public Types | |
enum | Level : int32_t { LEVEL_NONE = 0 , LEVEL_DEBUG = 1 , LEVEL_INFO = 2 , LEVEL_WARN = 3 , LEVEL_ERROR = 4 , LEVEL_FATAL = 5 } |
Enumeration of log levels. More... | |
Public Member Functions | |
Logger (Level min_level=LEVEL_INFO) | |
Constructor. More... | |
virtual | ~Logger ()=default |
Destructor. More... | |
virtual void | SetMinLevel (Level min_level) |
Sets the minimum log level. More... | |
virtual bool | CheckLevel (Level level) const |
Checks whether a log level is worth storing. More... | |
virtual void | Log (Level level, std::string_view message)=0 |
Logs a message. More... | |
virtual void | LogF (Level level, const char *format,...) |
Logs a formatted message. More... | |
template<typename FIRST , typename... REST> | |
void | LogCat (Level level, const FIRST &first, const REST &... rest) |
Logs a message made of substrings. More... | |
Static Public Member Functions | |
static Level | ParseLevelStr (std::string_view str) |
Parses a string to get an enum of log levels. More... | |
Protected Attributes | |
Level | min_level_ |
The minimum log level to be stored. More... | |
Interface for logging operations.
enum tkrzw::Logger::Level : int32_t |
Enumeration of log levels.
|
explicit |
Constructor.
min_level | The minimum log level to be stored. |
|
virtualdefault |
Destructor.
|
virtual |
Sets the minimum log level.
min_level | The minimum log level to be stored. |
|
virtual |
Checks whether a log level is worth storing.
|
pure virtual |
Logs a message.
level | The log level. |
message | The message to write. |
Implemented in tkrzw::BaseLogger.
|
virtual |
Logs a formatted message.
level | The log level. |
format | The format string. |
... | The other arguments. |
void tkrzw::Logger::LogCat | ( | Level | level, |
const FIRST & | first, | ||
const REST &... | rest | ||
) |
Logs a message made of substrings.
level | The log level. |
first | The first substring. |
rest | The rest substrings. |
|
static |
Parses a string to get an enum of log levels.
str | The string to parse |
|
protected |
The minimum log level to be stored.