MySQL 8.0.39
Source Code Documentation
Log_event_handler Class Referenceabstract

Abstract superclass for handling logging to slow/general logs. More...

#include <log.h>

Inheritance diagram for Log_event_handler:
[legend]

Public Member Functions

 Log_event_handler ()=default
 
virtual ~Log_event_handler ()=default
 
virtual bool log_slow (THD *thd, ulonglong current_utime, ulonglong query_start_arg, const char *user_host, size_t user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, const char *sql_text, size_t sql_text_len)=0
 Log a query to the slow log. More...
 
virtual bool log_general (THD *thd, ulonglong event_utime, const char *user_host, size_t user_host_len, my_thread_id thread_id, const char *command_type, size_t command_type_len, const char *sql_text, size_t sql_text_len, const CHARSET_INFO *client_cs)=0
 Log command to the general log. More...
 

Detailed Description

Abstract superclass for handling logging to slow/general logs.

Currently has two subclasses, for table and file based logging.

Constructor & Destructor Documentation

◆ Log_event_handler()

Log_event_handler::Log_event_handler ( )
default

◆ ~Log_event_handler()

virtual Log_event_handler::~Log_event_handler ( )
virtualdefault

Member Function Documentation

◆ log_general()

virtual bool Log_event_handler::log_general ( THD thd,
ulonglong  event_utime,
const char *  user_host,
size_t  user_host_len,
my_thread_id  thread_id,
const char *  command_type,
size_t  command_type_len,
const char *  sql_text,
size_t  sql_text_len,
const CHARSET_INFO client_cs 
)
pure virtual

Log command to the general log.

Parameters
thdTHD of the query
event_utimeCommand start timestamp in micro seconds
user_hostThe pointer to the string with user@host info
user_host_lenLength of the user_host string. this is computed once and passed to all general log event handlers
thread_idId of the thread, issued a query
command_typeThe type of the command being logged
command_type_lenThe length of the string above
sql_textThe very text of the query being executed
sql_text_lenThe length of sql_text string
client_csCharacter set to use for strings
Returns
This function attempts to never call my_error(). This is necessary, because general logging happens already after a statement status has been sent to the client, so the client can not see the error anyway. Besides, the error is not related to the statement being executed and is internal, and thus should be handled internally (
Return values
falseOK
trueerror occurred

Implemented in Log_to_file_event_handler, and Log_to_csv_event_handler.

◆ log_slow()

virtual bool Log_event_handler::log_slow ( THD thd,
ulonglong  current_utime,
ulonglong  query_start_arg,
const char *  user_host,
size_t  user_host_len,
ulonglong  query_utime,
ulonglong  lock_utime,
bool  is_command,
const char *  sql_text,
size_t  sql_text_len 
)
pure virtual

Log a query to the slow log.

Parameters
thdTHD of the query
current_utimeCurrent timestamp in microseconds
query_start_argCommand start timestamp in microseconds
user_hostThe pointer to the string with user@host info
user_host_lenLength of the user_host string
query_utimeNumber of microseconds query execution took
lock_utimeNumber of microseconds the query was locked
is_commandThe flag which determines whether the sql_text is a query or an administrator command
sql_textThe query or administrator in textual form
sql_text_lenThe length of sql_text string
Returns
true if error, false otherwise.

Implemented in Log_to_file_event_handler, and Log_to_csv_event_handler.


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