MySQL 8.0.40
Source Code Documentation
ib::logger Class Reference

The class logger is the base class of all the error log related classes. More...

#include <ut0log.h>

Inheritance diagram for ib::logger:
[legend]

Public Member Functions

virtual ~logger ()
 Destructor. More...
 
template<class... Args>
loggerlog (int err, Args &&...args)
 Format an error message. More...
 
template<typename T >
loggeroperator<< (const T &rhs)
 
std::ostream & write (const char *buf, std::streamsize count)
 Write the given buffer to the internal string stream object. More...
 
std::ostream & write (const unsigned char *buf, std::streamsize count)
 Write the given buffer to the internal string stream object. More...
 

Public Attributes

std::ostringstream m_oss
 For converting the message into a string. More...
 
int m_err {}
 Error code in errmsg-*.txt. More...
 
loglevel m_level {INFORMATION_LEVEL}
 Error logging level. More...
 

Protected Member Functions

void log_event (std::string msg)
 Uses LogEvent to report the log entry, using provided message. More...
 
 logger (loglevel level, int err)
 Constructor. More...
 
template<class... Args>
 logger (loglevel level, int err, Args &&...args)
 Constructor. More...
 
 logger (loglevel level)
 Constructor. More...
 

Static Protected Member Functions

template<class... Args>
static std::string msg (int err, Args &&...args)
 Format an error message. More...
 

Detailed Description

The class logger is the base class of all the error log related classes.

It contains a std::ostringstream object. The main purpose of this class is to forward operator<< to the underlying std::ostringstream object. Do not use this class directly, instead use one of the derived classes.

Constructor & Destructor Documentation

◆ ~logger()

ib::logger::~logger ( )
virtual

Destructor.

◆ logger() [1/3]

ib::logger::logger ( loglevel  level,
int  err 
)
inlineprotected

Constructor.

Parameters
[in]levelLogging level
[in]errError message code.

◆ logger() [2/3]

template<class... Args>
ib::logger::logger ( loglevel  level,
int  err,
Args &&...  args 
)
inlineexplicitprotected

Constructor.

Parameters
[in]levelLogging level
[in]errError message code.
[in]argsVariable length argument list

◆ logger() [3/3]

ib::logger::logger ( loglevel  level)
inlineexplicitprotected

Constructor.

Parameters
[in]levelLog error level

Member Function Documentation

◆ log()

template<class... Args>
logger & ib::logger::log ( int  err,
Args &&...  args 
)
inline

Format an error message.

Parameters
[in]errError code from errmsg-*.txt.
[in]argsVariable length argument list

◆ log_event()

void ib::logger::log_event ( std::string  msg)
protected

Uses LogEvent to report the log entry, using provided message.

Parameters
[in]msgmessage to be logged

◆ msg()

template<class... Args>
static std::string ib::logger::msg ( int  err,
Args &&...  args 
)
inlinestaticprotected

Format an error message.

Parameters
[in]errError code from errmsg-*.txt.
[in]argsVariable length argument list

◆ operator<<()

template<typename T >
logger & ib::logger::operator<< ( const T &  rhs)
inline

◆ write() [1/2]

std::ostream & ib::logger::write ( const char *  buf,
std::streamsize  count 
)
inline

Write the given buffer to the internal string stream object.

Parameters
[in]bufthe buffer contents to log.
[in]countthe length of the buffer buf.
Returns
the output stream into which buffer was written.

◆ write() [2/2]

std::ostream & ib::logger::write ( const unsigned char *  buf,
std::streamsize  count 
)
inline

Write the given buffer to the internal string stream object.

Parameters
[in]bufthe buffer contents to log
[in]countthe length of the buffer buf.
Returns
the output stream into which buffer was written.

Member Data Documentation

◆ m_err

int ib::logger::m_err {}

Error code in errmsg-*.txt.

◆ m_level

loglevel ib::logger::m_level {INFORMATION_LEVEL}

Error logging level.

◆ m_oss

std::ostringstream ib::logger::m_oss

For converting the message into a string.


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