MySQL 8.1.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 

◆ Logger() [2/2]

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

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

◆ get_level()

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

◆ get_timestamp_precision()

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

◆ 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.

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)

◆ set_timestamp_precision()

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

Member Data Documentation

◆ handlers_

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

◆ level_

LogLevel mysql_harness::logging::Logger::level_

◆ precision_

LogTimestampPrecision mysql_harness::logging::Logger::precision_

◆ registry_

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

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