qxLib
Public Member Functions | Static Public Member Functions | Protected 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::cout_logger_stream qx::debugger_logger_stream qx::file_logger_stream

Public Member Functions

 base_logger_stream (bool bAlwaysFlush)
 base_logger_stream object constructor More...
 
virtual void flush ()=0
 Flush stream.
 
void log (verbosity eVerbosity, const category &category, string_view svFile, string_view svFunction, int nLine, string_view swLogMessage)
 Output to stream. More...
 
void register_unit (string_view svUnitName, const log_unit_info &unit) noexcept
 Register logger unit. More...
 
void deregister_unit (string_view svUnitName) noexcept
 Deregister logger unit. More...
 
std::optional< log_unitget_unit_info (const category &category, verbosity eVerbosity, string_view svFile, string_view svFunction) const noexcept
 Try to find log unit info based on trace location info. More...
 

Static Public Member Functions

static void append_time_string (string &sTime, char_type chDateDelimiter, char_type chTimeDelimiter) noexcept
 Format time string to the buffer. More...
 

Protected Member Functions

logger_bufferget_log_buffer () noexcept
 Get string buffers. More...
 
virtual void format_line (logger_buffer &buffers, verbosity eVerbosity, const category &category, string_view svFile, string_view svFunction, int nLine, string_view swLogMessage) noexcept
 Format logger line. More...
 

Detailed Description

Base class for logger streams.

~

Author
Khrapov
Date
28.07.2021

Definition at line 77 of file base_logger_stream.h.

Constructor & Destructor Documentation

◆ base_logger_stream()

qx::base_logger_stream::base_logger_stream ( bool  bAlwaysFlush)
inline

base_logger_stream object constructor

Parameters
bAlwaysFlush- true if need to flush after every output, decreases performance

Definition at line 15 of file base_logger_stream.inl.

Member Function Documentation

◆ append_time_string()

void qx::base_logger_stream::append_time_string ( string sTime,
char_type  chDateDelimiter,
char_type  chTimeDelimiter 
)
inlinestaticnoexcept

Format time string to the buffer.

Parameters
sTime- output time buffer
chDateDelimiter- char to use as delimiter in date part
chTimeDelimiter- char to use as delimiter in time part

Definition at line 109 of file base_logger_stream.inl.

◆ deregister_unit()

void qx::base_logger_stream::deregister_unit ( string_view  svUnitName)
inlinenoexcept

Deregister logger unit.

Parameters
svUnitName- unit name (category name, file or function)

Definition at line 74 of file base_logger_stream.inl.

◆ format_line()

void qx::base_logger_stream::format_line ( logger_buffer buffers,
verbosity  eVerbosity,
const category category,
string_view  svFile,
string_view  svFunction,
int  nLine,
string_view  swLogMessage 
)
inlineprotectedvirtualnoexcept

Format logger line.

Parameters
buffers- string buffers to reduce num of allocations
eVerbosity- message verbosity
category- code category
svFile- file name string
svFunction- function name string
nLine- code line number
swLogMessage- formatted log line

Definition at line 138 of file base_logger_stream.inl.

◆ get_log_buffer()

logger_buffer & qx::base_logger_stream::get_log_buffer ( )
inlineprotectednoexcept

Get string buffers.

Return values
-string buffers

Definition at line 133 of file base_logger_stream.inl.

◆ get_unit_info()

std::optional< log_unit > qx::base_logger_stream::get_unit_info ( const category category,
verbosity  eVerbosity,
string_view  svFile,
string_view  svFunction 
) const
inlinenoexcept

Try to find log unit info based on trace location info.

Parameters
category- code category
eVerbosity- message verbosity
svFile- file string
svFunction- function string
Return values
-log unit info if found

Definition at line 79 of file base_logger_stream.inl.

◆ log()

void qx::base_logger_stream::log ( verbosity  eVerbosity,
const category category,
string_view  svFile,
string_view  svFunction,
int  nLine,
string_view  swLogMessage 
)
inline

Output to stream.

Template Parameters
char_t- char type, typically char or wchar_t
Parameters
eVerbositymessage verbosity
category- code category
svFile- file name string
svFunction- function name string
nLine- code line number
swLogMessage- formatted log line

Definition at line 20 of file base_logger_stream.inl.

◆ register_unit()

void qx::base_logger_stream::register_unit ( string_view  svUnitName,
const log_unit_info unit 
)
inlinenoexcept

Register logger unit.

Parameters
svUnitName- unit name (category name, file or function)
unit- unit info

Definition at line 68 of file base_logger_stream.inl.


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