MySQL 9.1.0
Source Code Documentation
Gcs_default_debugger Class Reference

Default debugger which is used only by GCS and XCOM. More...

#include <gcs_logging_system.h>

Public Member Functions

 Gcs_default_debugger (Gcs_async_buffer *sink)
 
virtual ~Gcs_default_debugger ()=default
 
enum_gcs_error initialize ()
 Default debugger initialization method. More...
 
enum_gcs_error finalize ()
 Default debugger finalization method. More...
 
void log_event (const char *format, va_list args)
 Asynchronously forwards the received message to a sink. More...
 
void log_event (const std::string &message)
 Default debugger simply forwards the received message to a sink. More...
 
Gcs_log_eventget_entry ()
 Get a reference to the in-memory buffer where the message content will be copied to if there is any. More...
 
void notify_entry (Gcs_log_event &entry)
 Notify that the in-memory buffer were filled in and is ready to be consumed. More...
 
void log_event (int64_t options, const char *message)
 Asynchronously forwards the received message to a sink. More...
 
template<typename... Args>
void log_event (const int64_t options, Args... args)
 Asynchronously forwards the received message to a sink. More...
 

Private Member Functions

size_t append_prefix (char *buffer)
 Add extra information as a message prefix. More...
 
size_t append_sufix (char *buffer, size_t size)
 Append information into a message such as end of line. More...
 
 Gcs_default_debugger (Gcs_default_debugger &d)
 
Gcs_default_debuggeroperator= (const Gcs_default_debugger &d)
 

Private Attributes

Gcs_async_bufferm_sink
 Reference to an asynchronous buffer that encapsulates a sink. More...
 

Detailed Description

Default debugger which is used only by GCS and XCOM.

Constructor & Destructor Documentation

◆ Gcs_default_debugger() [1/2]

Gcs_default_debugger::Gcs_default_debugger ( Gcs_async_buffer sink)
explicit

◆ ~Gcs_default_debugger()

virtual Gcs_default_debugger::~Gcs_default_debugger ( )
virtualdefault

◆ Gcs_default_debugger() [2/2]

Gcs_default_debugger::Gcs_default_debugger ( Gcs_default_debugger d)
private

Member Function Documentation

◆ append_prefix()

size_t Gcs_default_debugger::append_prefix ( char *  buffer)
inlineprivate

Add extra information as a message prefix.

We assume that there is room to accommodate it. Before changing this method, make sure the maximum buffer size will always have room to accommodate any new information.

Returns
Return the size of appended information

◆ append_sufix()

size_t Gcs_default_debugger::append_sufix ( char *  buffer,
size_t  size 
)
inlineprivate

Append information into a message such as end of line.

We assume that there is room to accommodate it. Before changing this method, make sure the maximum buffer size will always have room to accommodate any new information.

Returns
Return the size of appended information

◆ finalize()

enum_gcs_error Gcs_default_debugger::finalize ( )

Default debugger finalization method.

Returns
GCS_OK

◆ get_entry()

Gcs_log_event & Gcs_default_debugger::get_entry ( )
inline

Get a reference to the in-memory buffer where the message content will be copied to if there is any.

◆ initialize()

enum_gcs_error Gcs_default_debugger::initialize ( )

Default debugger initialization method.

Returns
GCS_OK

◆ log_event() [1/4]

void Gcs_default_debugger::log_event ( const char *  format,
va_list  args 
)
inline

Asynchronously forwards the received message to a sink.

This method prepares the message and writes it to an in-memory buffer. If there is no free entry in the in-memory buffer, the call blocks until an entry becomes available.

Note that the write to the sink is done asynchronously.

This method shouldn't be invoked directly in the code, as it is wrapped by the MYSQL_GCS_LOG_[LEVEL] macros which deal with the rendering of the logging message into a final string that is then handed alongside with the level to this method.

Parameters
[in]formatMessage format using a c-style string
[in]argsArguments to fill in the format string

◆ log_event() [2/4]

template<typename... Args>
void Gcs_default_debugger::log_event ( const int64_t  options,
Args...  args 
)
inline

Asynchronously forwards the received message to a sink.

This method prepares the message and writes it to an in-memory buffer. If there is no free entry in the in-memory buffer, the call blocks until an entry becomes available.

Note that the write to the sink is done asynchronously.

This method shouldn't be invoked directly in the code, as it is wrapped by the MYSQL_GCS_LOG_[LEVEL] macros which deal with the rendering of the logging message into a final string that is then handed alongside with the level to this method.

Parameters
[in]optionsDebug options that are associated with the message
[in]argsArguments This includes the c-style string and arguments to fill it in

◆ log_event() [3/4]

void Gcs_default_debugger::log_event ( const std::string &  message)

Default debugger simply forwards the received message to a sink.

Parameters
messagerendered string of the logging message

◆ log_event() [4/4]

void Gcs_default_debugger::log_event ( int64_t  options,
const char *  message 
)
inline

Asynchronously forwards the received message to a sink.

This method prepares the message and writes it to an in-memory buffer. If there is no free entry in the in-memory buffer, the call blocks until an entry becomes available.

Note that the write to the sink is done asynchronously.

This method shouldn't be invoked directly in the code, as it is wrapped by the MYSQL_GCS_LOG_[LEVEL] macros which deal with the rendering of the logging message into a final string that is then handed alongside with the level to this method.

Parameters
[in]optionsDebug options that are associated with the message
[in]messageMessage to be written to the in-memory buffer

◆ notify_entry()

void Gcs_default_debugger::notify_entry ( Gcs_log_event entry)
inline

Notify that the in-memory buffer were filled in and is ready to be consumed.

◆ operator=()

Gcs_default_debugger & Gcs_default_debugger::operator= ( const Gcs_default_debugger d)
private

Member Data Documentation

◆ m_sink

Gcs_async_buffer* Gcs_default_debugger::m_sink
private

Reference to an asynchronous buffer that encapsulates a sink.


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