Tkrzw
|
Base implementation for logging operations. More...
#include <tkrzw_logger.h>
Public Types | |
enum | DateFormat : int32_t { DATE_NONE = 0 , DATE_SIMPLE = 1 , DATE_SIMPLE_MICRO = 2 , DATE_W3CDTF = 3 , DATE_W3CDTF_MICRO = 4 , DATE_RFC1123 = 5 , DATE_EPOCH = 6 , DATE_EPOCH_MICRO = 7 } |
Enumeration of date formats. More... | |
Public Types inherited from tkrzw::Logger | |
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 | |
BaseLogger (Level min_level=LEVEL_INFO, const char *separator=" ", DateFormat date_format=DATE_SIMPLE, int32_t date_td=INT32MIN) | |
Constructor. More... | |
virtual | ~BaseLogger ()=default |
Destructor. More... | |
virtual void | SetSeparator (const char *separator) |
Sets the separator string between fields. More... | |
virtual void | SetDateFormat (DateFormat date_format, int32_t date_td=INT32MIN) |
Sets the data format of each log. More... | |
virtual void | WriteRaw (std::string_view raw_data)=0 |
Writes a log into the media. More... | |
virtual void | WriteProperties (Level level, std::string_view message) |
Formats properties of a log into a string and write it. More... | |
void | Log (Level level, std::string_view message) override |
Logs a message. More... | |
Public Member Functions inherited from tkrzw::Logger | |
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 | 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 DateFormat | ParseDateFormatStr (std::string_view str) |
Parses a string to get an enum of date formats. More... | |
Static Public Member Functions inherited from tkrzw::Logger | |
static Level | ParseLevelStr (std::string_view str) |
Parses a string to get an enum of log levels. More... | |
Protected Attributes | |
std::string_view | separator_ |
The separator between fields. More... | |
DateFormat | date_format_ |
The date format. More... | |
int32_t | date_td_ |
The date time difference. More... | |
Protected Attributes inherited from tkrzw::Logger | |
Level | min_level_ |
The minimum log level to be stored. More... | |
Base implementation for logging operations.
enum tkrzw::BaseLogger::DateFormat : int32_t |
Enumeration of date formats.
|
explicit |
Constructor.
min_level | The minimum log level to be stored. |
separator | The separator string between fields. |
date_format | The date format. |
date_td | the time difference of the timze zone. If it is INT32MIN, the local time zone is specified. |
|
virtualdefault |
Destructor.
|
virtual |
Sets the separator string between fields.
separator | The separator string between fields. |
|
virtual |
Sets the data format of each log.
date_format | The date format. |
date_td | the time difference of the timze zone. If it is INT32MIN, the local time zone is specified. |
|
pure virtual |
Writes a log into the media.
raw_data | Formatted log data. |
Implemented in tkrzw::StreamLogger.
|
virtual |
Formats properties of a log into a string and write it.
level | The log level. |
message | The message to write. |
|
overridevirtual |
Logs a message.
level | The log level. |
message | The message to write. |
Implements tkrzw::Logger.
|
static |
Parses a string to get an enum of date formats.
str | The string to parse |
|
protected |
The separator between fields.
|
protected |
The date format.
|
protected |
The date time difference.