MySQL 8.4.0
Source Code Documentation
mysql_harness::logging::Logger Class Reference

Logger class. More...

#include <logger.h>

Public Member Functions

 Logger (Registry &registry, LogLevel level=kDefaultLogLevel)
 
 Logger ()
 
void attach_handler (std::string name)
 
void detach_handler (std::string name, bool handler_must_exist=true)
 
void handle (const Record &record)
 
bool is_handled (LogLevel level) const
 check if the log-level will be handled. More...
 
const std::set< std::string > & get_handler_names () const
 
void set_level (LogLevel level)
 
LogLevel get_level () const
 
void set_timestamp_precision (LogTimestampPrecision precision)
 
LogTimestampPrecision get_timestamp_precision () const
 

Private Attributes

LogLevel level_
 
LogTimestampPrecision precision_
 
std::set< std::string > handlers_
 
const Registryregistry_
 

Detailed Description

Logger class.

The logger class handles the logging for one or more logging handlers. Each logger class instance keeps state for logging for one module or subsystem. You can add handlers to a logger which will then be used for all logging to that subsystem.

Constructor & Destructor Documentation

◆ Logger() [1/2]

mysql_harness::logging::Logger::Logger ( Registry registry,
LogLevel  level = kDefaultLogLevel 
)
explicit

◆ Logger() [2/2]

mysql_harness::logging::Logger::Logger ( )
inline

Member Function Documentation

◆ attach_handler()

void mysql_harness::logging::Logger::attach_handler ( std::string  name)

◆ detach_handler()

void mysql_harness::logging::Logger::detach_handler ( std::string  name,
bool  handler_must_exist = true 
)

◆ get_handler_names()

const std::set< std::string > & mysql_harness::logging::Logger::get_handler_names ( ) const
inline

◆ get_level()

LogLevel mysql_harness::logging::Logger::get_level ( ) const
inline

◆ get_timestamp_precision()

LogTimestampPrecision mysql_harness::logging::Logger::get_timestamp_precision ( ) const
inline

◆ handle()

void mysql_harness::logging::Logger::handle ( const Record record)

◆ is_handled()

bool mysql_harness::logging::Logger::is_handled ( LogLevel  level) const

check if the log-level will be handled.

log-messages may be filtered on global and on handler level.

in case it is not handled, there is no need call the prepare data for the log-function.

Returns
if log-level will be handled or not
Return values
truelog-level (quite likely) will be handled
falselog-level will be ignored

◆ set_level()

void mysql_harness::logging::Logger::set_level ( LogLevel  level)
inline

◆ set_timestamp_precision()

void mysql_harness::logging::Logger::set_timestamp_precision ( LogTimestampPrecision  precision)
inline

Member Data Documentation

◆ handlers_

std::set<std::string> mysql_harness::logging::Logger::handlers_
private

◆ level_

LogLevel mysql_harness::logging::Logger::level_
private

◆ precision_

LogTimestampPrecision mysql_harness::logging::Logger::precision_
private

◆ registry_

const Registry* mysql_harness::logging::Logger::registry_
private

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