qxLib
Classes | Public Member Functions | List of all members
qx::base_logger_stream Class Referenceabstract

Base class for logger streams. More...

#include <base_logger_stream.h>

Inheritance diagram for qx::base_logger_stream:
qx::rtti_root< naming_strategy_t > qx::rtti_pure_base qx::base_file_logger_stream qx::base_standard_streams_stream qx::debugger_logger_stream qx::error_context_stream qx::file_logger_stream_fopen qx::file_logger_stream_mapping qx::file_logger_stream_ofstream qx::cout_logger_stream qx::fwrite_logger_stream

Classes

struct  config
 

Public Member Functions

 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::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

Base class for logger streams.

Author
Khrapov
Date
28.07.2021

Definition at line 37 of file base_logger_stream.h.

Constructor & Destructor Documentation

◆ base_logger_stream()

qx::base_logger_stream::base_logger_stream ( const config &  streamConfig)
inlinenoexcept

base_logger_stream object constructor

Parameters
streamConfig- logger configuration

Definition at line 56 of file base_logger_stream.inl.

Member Function Documentation

◆ get_pattern()

std::optional< string_view > qx::base_logger_stream::get_pattern ( ) const
inlinenoexcept

Get a message pattern if present.

Return values
-a pattern for the stream

Definition at line 73 of file base_logger_stream.inl.

◆ log()

void qx::base_logger_stream::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 
)
inline

Output to stream.

Template Parameters
char_t- char type, typically char or wchar_t
Parameters
category- code category
eVerbosity- 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- formatted log line

Definition at line 78 of file base_logger_stream.inl.

◆ log_unconditionally_required()

bool qx::base_logger_stream::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
inlinevirtualnoexcept

Returns true if this message should be processed by this stream even if the logger filters did not pass it.

Parameters
category- code category
eVerbosity- 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
Return values
-true is this message is unconditionally required by this stream

Definition at line 115 of file base_logger_stream.inl.

◆ set_pattern()

compile_pattern_result qx::base_logger_stream::set_pattern ( pattern_string_t  sPattern)
inlinenoexcept

Set a message pattern that will be used for this stream.

See also
qx::logger_specifiers for details
Warning
Not thread safe on purpose. Set it before you pass this stream to a logger!
Parameters
sPattern- a pattern for the stream
Return values
-pattern compilation result

Definition at line 63 of file base_logger_stream.inl.


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