|
Tkrzw
|
Stream implementation for logging operations. More...
#include <tkrzw_logger.h>
Public Member Functions | |
| StreamLogger (std::ostream *stream=nullptr, Level min_level=LEVEL_INFO, const char *separator=" ", DateFormat date_format=DATE_SIMPLE, int32_t date_td=INT32MIN) | |
| Constructor. More... | |
| virtual | ~StreamLogger ()=default |
| Destructor. More... | |
| virtual void | SetStream (std::ostream *stream) |
| Sets the stream object. More... | |
| void | WriteRaw (std::string_view raw_data) override |
| Writes a log into the media. More... | |
Public Member Functions inherited from tkrzw::BaseLogger | |
| 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 | 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... | |
Protected Attributes | |
| std::ostream * | stream_ |
| The output stream. More... | |
| SpinMutex | mutex_ |
| The mutex for the stream. More... | |
Protected Attributes inherited from tkrzw::BaseLogger | |
| 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... | |
Additional Inherited Members | |
Public Types inherited from tkrzw::BaseLogger | |
| 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... | |
Static Public Member Functions inherited from tkrzw::BaseLogger | |
| 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... | |
Stream implementation for logging operations.
|
explicit |
Constructor.
| stream | The pointer to the output stream. The ownership is not taken. If it is nullptr, logging is not done. |
| 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 stream object.
| stream | The pointer to the output stream. The ownership is not taken. If it is nullptr, logging is not done. |
|
overridevirtual |
|
protected |
The output stream.
|
protected |
The mutex for the stream.