|
Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
#include <structured_logger.h>


Public Member Functions | |
| void | set_format (structured_format format) |
| Set the output format. | |
| void | set_output_callback (structured_output_callback callback) |
| Set a custom output callback. | |
| void | set_output_to_stderr (bool use_stderr) |
| Set whether to output to stderr (default: stdout) | |
| void | log_structured (const structured_log_entry &entry) override |
| Log a structured message. | |
| log_builder | start_log (log_level level) override |
| Start building a structured log entry. | |
Public Member Functions inherited from kcenon::logger::structured::structured_logger_interface | |
| virtual | ~structured_logger_interface ()=default |
Static Private Member Functions | |
| static std::string | format_logfmt (const structured_log_entry &entry) |
| Format entry in logfmt style (key=value pairs) | |
| static std::string | level_to_string (log_level level) |
| static std::string | format_timestamp_logfmt (std::chrono::system_clock::time_point tp) |
| static std::string | escape_logfmt_value (const std::string &value) |
Private Attributes | |
| structured_format | format_ = structured_format::json |
| structured_output_callback | output_callback_ |
| bool | output_to_stderr_ = false |
Definition at line 158 of file structured_logger.h.
|
inlinestaticprivate |
Definition at line 271 of file structured_logger.h.
Referenced by format_logfmt().

|
inlinestaticprivate |
Format entry in logfmt style (key=value pairs)
Definition at line 218 of file structured_logger.h.
References escape_logfmt_value(), kcenon::logger::structured::structured_log_entry::fields, format_timestamp_logfmt(), kcenon::logger::structured::structured_log_entry::level, level_to_string(), kcenon::logger::structured::structured_log_entry::message, and kcenon::logger::structured::structured_log_entry::timestamp.
Referenced by log_structured().


|
inlinestaticprivate |
Definition at line 260 of file structured_logger.h.
Referenced by format_logfmt().

|
inlinestaticprivate |
Definition at line 247 of file structured_logger.h.
Referenced by format_logfmt().

|
inlineoverridevirtual |
Log a structured message.
Implements kcenon::logger::structured::structured_logger_interface.
Definition at line 189 of file structured_logger.h.
References kcenon::logger::structured::json_formatter::format(), format_, format_logfmt(), kcenon::logger::structured::json, kcenon::logger::structured::structured_log_entry::level, kcenon::logger::structured::logfmt, output_callback_, and output_to_stderr_.

|
inline |
Set the output format.
| format | The format to use (json or logfmt) |
Definition at line 169 of file structured_logger.h.
References format_.
|
inline |
Set a custom output callback.
| callback | Function to call with formatted log output |
Definition at line 177 of file structured_logger.h.
References output_callback_.
|
inline |
Set whether to output to stderr (default: stdout)
| use_stderr | If true, output to stderr; otherwise stdout |
Definition at line 185 of file structured_logger.h.
References output_to_stderr_.
|
inlineoverridevirtual |
Start building a structured log entry.
Implements kcenon::logger::structured::structured_logger_interface.
Definition at line 210 of file structured_logger.h.
|
private |
Definition at line 160 of file structured_logger.h.
Referenced by log_structured(), and set_format().
|
private |
Definition at line 161 of file structured_logger.h.
Referenced by log_structured(), and set_output_callback().
|
private |
Definition at line 162 of file structured_logger.h.
Referenced by log_structured(), and set_output_to_stderr().