quill
Public Types | Public Member Functions | Protected Attributes | List of all members
detail::JsonSink< TBase > Class Template Reference
Inheritance diagram for detail::JsonSink< TBase >:
Inheritance graph
[legend]
Collaboration diagram for detail::JsonSink< TBase >:
Collaboration graph
[legend]

Public Types

using base_type = TBase
 

Public Member Functions

QUILL_ATTRIBUTE_HOT void write_log (MacroMetadata const *log_metadata, uint64_t log_timestamp, std::string_view thread_id, std::string_view thread_name, std::string const &process_id, std::string_view logger_name, LogLevel log_level, std::string_view log_level_description, std::string_view log_level_short_code, std::vector< std::pair< std::string, std::string >> const *named_args, std::string_view log_message, std::string_view log_statement) override
 Logs a formatted log message to the sink. More...
 
virtual QUILL_ATTRIBUTE_HOT void generate_json_message (MacroMetadata const *log_metadata, uint64_t log_timestamp, std::string_view thread_id, std::string_view, std::string const &, std::string_view logger_name, LogLevel, std::string_view log_level_description, std::string_view, std::vector< std::pair< std::string, std::string >> const *named_args, std::string_view, std::string_view, char const *message_format)
 Generates a JSON-formatted log message. More...
 

Protected Attributes

fmtquill::memory_buffer _json_message
 
std::string _format
 

Member Function Documentation

◆ generate_json_message()

template<typename TBase>
virtual QUILL_ATTRIBUTE_HOT void detail::JsonSink< TBase >::generate_json_message ( MacroMetadata const *  log_metadata,
uint64_t  log_timestamp,
std::string_view  thread_id,
std::string_view  ,
std::string const &  ,
std::string_view  logger_name,
LogLevel  ,
std::string_view  log_level_description,
std::string_view  ,
std::vector< std::pair< std::string, std::string >> const *  named_args,
std::string_view  ,
std::string_view  ,
char const *  message_format 
)
inlinevirtual

Generates a JSON-formatted log message.

This function creates the default JSON structure for log messages, including the timestamp, file name, line number, thread information, logger name, log level, and message content.

It is designed to be customizable by overriding in derived classes. Users can provide their own implementation to generate a log message in a custom format or to include additional fields.

◆ write_log()

template<typename TBase>
QUILL_ATTRIBUTE_HOT void detail::JsonSink< TBase >::write_log ( MacroMetadata const *  log_metadata,
uint64_t  log_timestamp,
std::string_view  thread_id,
std::string_view  thread_name,
std::string const &  process_id,
std::string_view  logger_name,
LogLevel  log_level,
std::string_view  log_level_description,
std::string_view  log_level_short_code,
std::vector< std::pair< std::string, std::string >> const *  named_args,
std::string_view  log_message,
std::string_view  log_statement 
)
inlineoverride

Logs a formatted log message to the sink.

Note
Accessor for backend processing.
Parameters
log_metadataPointer to the macro metadata.
log_timestampTimestamp of the log event.
thread_idID of the thread.
thread_nameName of the thread.
process_idProcess Id
logger_nameName of the logger.
log_levelLog level of the message.
log_level_descriptionDescription of the log level.
log_level_short_codeShort code representing the log level.
named_argsVector of key-value pairs of named args
log_messagelog message
log_statementlog statement

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