|
Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
Abstract interface for log message formatters. More...
#include <log_formatter_interface.h>


Public Member Functions | |
| virtual | ~log_formatter_interface ()=default |
| virtual std::string | format (const log_entry &entry) const =0 |
| Format a log entry to a string. | |
| virtual void | set_options (const format_options &opts) |
| Set formatting options. | |
| virtual format_options | get_options () const |
| Get current formatting options. | |
| virtual std::string | get_name () const =0 |
Protected Attributes | |
| format_options | options_ |
Abstract interface for log message formatters.
Defines the contract that all log formatters must implement. Formatters are responsible for converting log_entry structures into formatted strings ready for output.
Thread-safety: Formatters should be thread-safe as they may be called concurrently from multiple threads when used with async writers.
Definition at line 73 of file log_formatter_interface.h.
|
virtualdefault |
|
pure virtual |
Format a log entry to a string.
| entry | The log entry to format |
Converts the log_entry structure into a formatted string according to the formatter's specific format (text, JSON, XML, etc.).
Implemented in kcenon::logger::base_formatter, kcenon::logger::compact_formatter, kcenon::logger::json_formatter, kcenon::logger::json_formatter, kcenon::logger::logfmt_formatter, kcenon::logger::plain_formatter, kcenon::logger::template_formatter, and kcenon::logger::timestamp_formatter.
|
pure virtual |
|
inlinevirtual |
Get current formatting options.
Definition at line 114 of file log_formatter_interface.h.
References options_.
|
inlinevirtual |
Set formatting options.
| opts | Configuration options for formatting |
Allows runtime configuration of which elements to include in the formatted output. Not all formatters may support all options.
Definition at line 104 of file log_formatter_interface.h.
References options_.
|
protected |
Current formatting options
Definition at line 133 of file log_formatter_interface.h.
Referenced by kcenon::logger::json_formatter::format(), kcenon::logger::logfmt_formatter::format(), kcenon::logger::timestamp_formatter::format(), get_options(), kcenon::logger::template_formatter::resolve_placeholder(), and set_options().