LogIt++
Loading...
Searching...
No Matches
logit::ILogFormatter Interface Referenceabstract

Interface for formatting log records. More...

#include <ILogFormatter.hpp>

Inheritance diagram for logit::ILogFormatter:
logit::SimpleLogFormatter

Public Member Functions

virtual ~ILogFormatter ()=default
 
virtual void set_timestamp_offset (int64_t offset_ms)=0
 Sets the timestamp offset for log formatting.
 
virtual std::string format (const LogRecord &record) const =0
 Formats a log record into a string.
 

Detailed Description

Interface for formatting log records.

The ILogFormatter class defines an interface that any log formatter must implement. It provides a pure virtual function for formatting a log record into a string.

Definition at line 14 of file ILogFormatter.hpp.

Constructor & Destructor Documentation

◆ ~ILogFormatter()

virtual logit::ILogFormatter::~ILogFormatter ( )
virtualdefault

Member Function Documentation

◆ format()

virtual std::string logit::ILogFormatter::format ( const LogRecord & record) const
pure virtual

Formats a log record into a string.

This pure virtual function must be implemented by any class deriving from ILogFormatter. The implementation should format the log record into a human-readable or machine-readable string.

Parameters
recordThe log record to be formatted.
Returns
A string representing the formatted log message.

Implemented in logit::SimpleLogFormatter.

◆ set_timestamp_offset()

virtual void logit::ILogFormatter::set_timestamp_offset ( int64_t offset_ms)
pure virtual

Sets the timestamp offset for log formatting.

This function allows setting a timezone offset in milliseconds, which will be used for adjusting timestamps in formatted log messages.

Parameters
offset_msTimezone offset in milliseconds.

Implemented in logit::SimpleLogFormatter.


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