qxLib
Public Member Functions | List of all members
qx::file_logger_stream_ofstream Class Reference

std::ofstream based file logger stream More...

#include <file_logger_stream_ofstream.h>

Inheritance diagram for qx::file_logger_stream_ofstream:
qx::base_file_logger_stream qx::base_logger_stream qx::rtti_root< naming_strategy_t > qx::rtti_pure_base

Public Member Functions

 file_logger_stream_ofstream (const config &streamConfig=config(), unit< size_t, units::data > bufferSize={ 8192 *sizeof(char_type), units::data::bytes })
 file_logger_stream_ofstream object constructor More...
 
virtual void do_log (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine, string_view svMessage) override
 Proceed stream logging. More...
 
virtual void do_flush () override
 Flush the stream.
 
- Public Member Functions inherited from qx::base_file_logger_stream
 base_file_logger_stream (const config &streamConfig) noexcept
 file_logger_stream object constructor More...
 
- Public Member Functions inherited from qx::base_logger_stream
 base_logger_stream (const config &streamConfig) noexcept
 base_logger_stream object constructor More...
 
compile_pattern_result set_pattern (pattern_string_t sPattern) noexcept
 Set a message pattern that will be used for this stream. More...
 
std::optional< string_view > get_pattern () const noexcept
 Get a message pattern if present. More...
 
void log (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine, string_view svMessage)
 Output to stream. More...
 
void flush ()
 Flush the stream.
 
virtual bool log_unconditionally_required (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine) const noexcept
 Returns true if this message should be processed by this stream even if the logger filters did not pass it. More...
 
- Public Member Functions inherited from qx::rtti_root< naming_strategy_t >
template<class T >
bool is_derived_from () const noexcept
 Test exact identity or membership in the object's RTTI base chain. More...
 
template<class T >
bool is () const noexcept
 Compare the object's dynamic class identifier with T's identifier. More...
 
bool is (string_view svClassName) const noexcept
 Compare against the class name selected by the naming strategy. More...
 
bool is (const class_id &id) const noexcept
 Compare against the object's dynamic class identifier. More...
 
virtual bool is_derived_from_id (const class_id &id) const noexcept
 Test an identifier against the object's dynamic RTTI hierarchy. More...
 
virtual string_view get_class_name () const noexcept
 Get the name of the object's most-derived registered RTTI type. More...
 
virtual class_id get_class_id () const noexcept
 Get the identifier of the object's most-derived registered RTTI type. More...
 
virtual std::span< const class_id > get_inheritance_sequence () const =0
 Get the registered inheritance chain in base-to-derived order. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from qx::rtti_root< naming_strategy_t >
static constexpr bool is_derived_from_id_static (const class_id &id) noexcept
 Test an identifier against the declaring type's static RTTI hierarchy. More...
 
static constexpr string_view get_class_name_static () noexcept
 Apply the naming strategy to the declaring RTTI type's signature. More...
 
static constexpr class_id get_class_id_static () noexcept
 Create the declaring RTTI type's identifier from its type signature. More...
 
- Protected Member Functions inherited from qx::base_file_logger_stream
std::filesystem::path prepare_folder_and_get_log_file_path (const config &config) noexcept
 Create a folder (if required) and get log file path. More...
 
- Protected Member Functions inherited from qx::rtti_root< naming_strategy_t >
virtual bool _is_base_id (const class_id &idBase) const noexcept
 Traverse identifiers treated as bases by derived RTTI classes. More...
 

Detailed Description

std::ofstream based file logger stream

UTF-8 LE (char) or UTF-16 LE (wchar_t)

Author
Khrapov
Date
14.01.2026

Definition at line 28 of file file_logger_stream_ofstream.h.

Constructor & Destructor Documentation

◆ file_logger_stream_ofstream()

qx::file_logger_stream_ofstream::file_logger_stream_ofstream ( const config &  streamConfig = config(),
unit< size_t, units::data >  bufferSize = { 8192 * sizeof(char_type), units::data::bytes } 
)
inline

file_logger_stream_ofstream object constructor

Parameters
streamConfig- file logger configuration
bufferSize- Outer buffer size for a FILE. if 0, the default buffer is used The buffer size determines how often data will be flushed. The default value of 8192 chars corresponds to ~30-50 lines of logs.

Definition at line 13 of file file_logger_stream_ofstream.inl.

Member Function Documentation

◆ do_log()

void qx::file_logger_stream_ofstream::do_log ( const category &  category,
verbosity  eVerbosity,
std::thread::id  threadId,
std::chrono::system_clock::time_point  messageTime,
string_view  svFile,
string_view  svFunction,
int  nLine,
string_view  svMessage 
)
inlineoverridevirtual

Proceed stream logging.

Parameters
category- code category
eVerbosity- this message verbosity
threadId- thread where the log is called
messageTime- message creation time
svFile- file name string
svFunction- function name string
nLine- code line number
svMessage- message string

Implements qx::base_logger_stream.

Definition at line 53 of file file_logger_stream_ofstream.inl.


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