quill
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
RotatingSink< TBase > Class Template Reference

The RotatingSink class. More...

#include <RotatingSink.h>

Inheritance diagram for RotatingSink< TBase >:
Inheritance graph
[legend]
Collaboration diagram for RotatingSink< TBase >:
Collaboration graph
[legend]

Classes

struct  FileInfo
 

Public Types

using base_type = TBase
 

Public Member Functions

 RotatingSink (fs::path const &filename, RotatingFileSinkConfig const &config, FileEventNotifier file_event_notifier=FileEventNotifier{}, std::chrono::system_clock::time_point start_time=std::chrono::system_clock::now())
 Constructor. More...
 
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
 Writes a formatted log message to the stream. More...
 

Protected Attributes

FileEventNotifier _file_event_notifier
 
std::deque< FileInfo_created_files
 We store in a queue the filenames we created, first: index, second: date/datetime, third: base_filename.
 
uint64_t _next_rotation_time
 The next rotation time point.
 
uint64_t _open_file_timestamp {0}
 The timestamp of the currently open file.
 
RotatingFileSinkConfig _config
 

Detailed Description

template<typename TBase>
class RotatingSink< TBase >

The RotatingSink class.

Constructor & Destructor Documentation

◆ RotatingSink()

template<typename TBase >
RotatingSink< TBase >::RotatingSink ( fs::path const &  filename,
RotatingFileSinkConfig const &  config,
FileEventNotifier  file_event_notifier = FileEventNotifier{},
std::chrono::system_clock::time_point  start_time = std::chrono::system_clock::now() 
)
inline

Constructor.

Creates a new instance of the RotatingSink class.

Parameters
filenameThe base file name to be used for logs.
configThe sink configuration.
file_event_notifierfile event notifier
start_timestart time

Member Function Documentation

◆ write_log()

template<typename TBase >
QUILL_ATTRIBUTE_HOT void RotatingSink< 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

Writes a formatted log message to the stream.

Parameters
log_metadataThe metadata of the log message
log_timestampThe timestamp of the log message
thread_idThe ID of the thread that generated the log message
thread_nameThe name of the thread that generated the log message
process_idProcess Id
logger_namelogger name
log_levelLog level of the message.
log_level_descriptionDescription of the log level.
log_level_short_codeShort code representing the log level.
named_argsStructured key-value pairs associated with the log message
log_messageThe log message to write
log_statementThe full log statement

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