Logger System 1.0.0
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::raw_formatter Class Reference

Formatter that returns log_entry.message verbatim. More...

#include <raw_formatter.h>

Inheritance diagram for kcenon::logger::raw_formatter:
Inheritance graph
Collaboration diagram for kcenon::logger::raw_formatter:
Collaboration graph

Public Member Functions

 raw_formatter ()=default
 
 ~raw_formatter () override=default
 
std::string format (const log_entry &entry) const override
 Format a log entry to a string.
 
std::string get_name () const override
 
- 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_
 

Detailed Description

Formatter that returns log_entry.message verbatim.

Thread-safety: stateless; safe to use concurrently.

Definition at line 39 of file raw_formatter.h.

Constructor & Destructor Documentation

◆ raw_formatter()

kcenon::logger::raw_formatter::raw_formatter ( )
default

◆ ~raw_formatter()

kcenon::logger::raw_formatter::~raw_formatter ( )
overridedefault

Member Function Documentation

◆ format()

std::string kcenon::logger::raw_formatter::format ( const log_entry & entry) const
inlineoverridevirtual

Format a log entry to a string.

Parameters
entryThe log entry to format
Returns
Formatted string ready for output

Converts the log_entry structure into a formatted string according to the formatter's specific format (text, JSON, XML, etc.).

Note
This method must be thread-safe.
Warning
Implementations should handle empty/null fields gracefully.
Since
1.2.0

Implements kcenon::logger::log_formatter_interface.

Definition at line 44 of file raw_formatter.h.

44 {
45 return entry.message.to_string();
46 }

References kcenon::logger::log_entry::message, and kcenon::logger::small_string< SSO_SIZE >::to_string().

Here is the call graph for this function:

◆ get_name()

std::string kcenon::logger::raw_formatter::get_name ( ) const
inlineoverridevirtual

Implements kcenon::logger::log_formatter_interface.

Definition at line 48 of file raw_formatter.h.

48 {
49 return "raw_formatter";
50 }

The documentation for this class was generated from the following file: