MySQL 8.4.0
Source Code Documentation
SyslogHandler Class Referencefinal

Unix-based systems specific logging handler(sink) that writes the logs to the syslog. More...

#include <syslog_plugin.h>

Inheritance diagram for SyslogHandler:

Public Member Functions

 SyslogHandler (bool format_messages=true, LogLevel level=LogLevel::kNotSet)
 ~SyslogHandler () override
void open (const std::string &ident) noexcept
void close () const noexcept
void reopen (const std::string) override
 Request to reopen underlying log sink. More...
- Public Member Functions inherited from mysql_harness::logging::Handler
 Handler ()=default
 Handler (const Handler &)=default
Handleroperator= (const Handler &)=default
virtual ~Handler ()=default
void handle (const Record &record)
void set_level (LogLevel level)
LogLevel get_level () const
void set_timestamp_precision (LogTimestampPrecision precision)
bool has_logged () const
 check if the handler has logged at least one record. More...

Static Public Attributes

static constexpr unsigned kMaxIdentSize = 100
- Static Public Attributes inherited from mysql_harness::logging::Handler
static constexpr const char * kDefaultName = nullptr
 Default identifier. More...

Private Member Functions

void do_log (const mysql_harness::logging::Record &record) noexcept override
 Log message handler primitive. More...

Static Private Member Functions

static int log_level_to_syslog (const LogLevel level) noexcept

Private Attributes

char ident_ [kMaxIdentSize]

Additional Inherited Members

- Protected Member Functions inherited from mysql_harness::logging::Handler
std::string format (const Record &record) const
 Handler (bool format_messages, LogLevel level, LogTimestampPrecision timestamp_precision)
void has_logged (bool v)

Detailed Description

Unix-based systems specific logging handler(sink) that writes the logs to the syslog.

Constructor & Destructor Documentation

◆ SyslogHandler()

SyslogHandler::SyslogHandler ( bool  format_messages = true,
LogLevel  level = LogLevel::kNotSet 

◆ ~SyslogHandler()

SyslogHandler::~SyslogHandler ( )

Member Function Documentation

◆ close()

void SyslogHandler::close ( ) const

◆ do_log()

void SyslogHandler::do_log ( const mysql_harness::logging::Record record)

Log message handler primitive.

This member function is implemented by subclasses to properly log a record wherever it need to be logged. If it is not possible to log the message properly, an exception should be thrown and will be caught by the caller.

recordRecord containing information about the message.

Implements mysql_harness::logging::Handler.

◆ log_level_to_syslog()

static int SyslogHandler::log_level_to_syslog ( const LogLevel  level)

◆ open()

void SyslogHandler::open ( const std::string &  ident)

◆ reopen()

void SyslogHandler::reopen ( const std::string  dst)

Request to reopen underlying log sink.

Should be no-op for handlers NOT writing to a file. Useful for log rotation, when the logger got the signal with the request to reopen the file. Provide a destination filename for the old file for file based handlers.

Implements mysql_harness::logging::Handler.

Member Data Documentation

◆ ident_

char SyslogHandler::ident_[kMaxIdentSize]

◆ kMaxIdentSize

constexpr unsigned SyslogHandler::kMaxIdentSize = 100

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