|
Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
Default formatter with human-readable timestamp format. More...
#include <timestamp_formatter.h>


Public Member Functions | |
| timestamp_formatter (const format_options &opts=format_options{}) | |
| Constructor with optional format options. | |
| std::string | format (const log_entry &entry) const override |
| Format a log entry to human-readable string. | |
| std::string | get_name () const override |
| Get formatter name. | |
Public Member Functions inherited from kcenon::logger::log_formatter_interface | |
| virtual | ~log_formatter_interface ()=default |
| virtual void | set_options (const format_options &opts) |
| Set formatting options. | |
| virtual format_options | get_options () const |
| Get current formatting options. | |
Additional Inherited Members | |
Protected Attributes inherited from kcenon::logger::log_formatter_interface | |
| format_options | options_ |
Default formatter with human-readable timestamp format.
Provides the traditional log format with timestamps, levels, and optional source location. This is the default formatter used by the logger system and is optimized for human readability.
Features:
Thread-safety: This formatter is stateless and thread-safe.
Definition at line 57 of file timestamp_formatter.h.
|
inlineexplicit |
Constructor with optional format options.
| opts | Initial format options |
Definition at line 65 of file timestamp_formatter.h.
|
inlineoverridevirtual |
Format a log entry to human-readable string.
| entry | The log entry to format |
Produces output in the format: [YYYY-MM-DD HH:MM:SS.mmm] [LEVEL] [thread:TID] message [file:line in function()]
Implements kcenon::logger::log_formatter_interface.
Definition at line 81 of file timestamp_formatter.h.
References kcenon::logger::utils::string_utils::color_reset(), kcenon::logger::utils::string_utils::extract_filename(), kcenon::logger::utils::time_utils::format_timestamp(), kcenon::logger::format_options::include_level, kcenon::logger::format_options::include_source_location, kcenon::logger::format_options::include_thread_id, kcenon::logger::format_options::include_timestamp, kcenon::logger::log_entry::level, kcenon::logger::utils::string_utils::level_to_color(), kcenon::logger::utils::string_utils::level_to_string(), kcenon::logger::log_entry::location, kcenon::logger::log_entry::message, kcenon::logger::log_formatter_interface::options_, kcenon::logger::log_entry::thread_id, kcenon::logger::log_entry::timestamp, kcenon::logger::small_string< SSO_SIZE >::to_string(), and kcenon::logger::format_options::use_colors.

|
inlineoverridevirtual |
Get formatter name.
Implements kcenon::logger::log_formatter_interface.
Definition at line 137 of file timestamp_formatter.h.