MySQL 9.4.0
Source Code Documentation
mysql_harness::logging::ExternalHandlerProxy Class Reference

Acts as a placeholder for a handler that can be attached later (does not log until this is done). More...

#include <handler.h>

Inheritance diagram for mysql_harness::logging::ExternalHandlerProxy:
[legend]

Public Types

using HandlerPtr = std::shared_ptr< ExternalHandler >
 

Public Member Functions

 ExternalHandlerProxy (bool format_messages, LogLevel level, LogTimestampPrecision timestamp_precision)
 
void reopen (const std::string dst="") override
 Request to reopen underlying log sink. More...
 
void attach_handler (HandlerPtr handler)
 
- 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...
 

Private Member Functions

void do_log (const Record &record) override
 Log message handler primitive. More...
 

Private Attributes

HandlerPtr handler_
 

Additional Inherited Members

- Static Public Attributes inherited from mysql_harness::logging::Handler
static constexpr const char * kDefaultName = nullptr
 Default identifier. More...
 
- 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

Acts as a placeholder for a handler that can be attached later (does not log until this is done).

Member Typedef Documentation

◆ HandlerPtr

Constructor & Destructor Documentation

◆ ExternalHandlerProxy()

mysql_harness::logging::ExternalHandlerProxy::ExternalHandlerProxy ( bool  format_messages,
LogLevel  level,
LogTimestampPrecision  timestamp_precision 
)
inline

Member Function Documentation

◆ attach_handler()

void mysql_harness::logging::ExternalHandlerProxy::attach_handler ( HandlerPtr  handler)
inline

◆ do_log()

void mysql_harness::logging::ExternalHandlerProxy::do_log ( const Record record)
inlineoverrideprivatevirtual

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.

Parameters
recordRecord containing information about the message.

Implements mysql_harness::logging::Handler.

◆ reopen()

void mysql_harness::logging::ExternalHandlerProxy::reopen ( const std::string  dst = "")
inlineoverridevirtual

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

◆ handler_

HandlerPtr mysql_harness::logging::ExternalHandlerProxy::handler_
private

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