MySQL 8.0.39
Source Code Documentation
s_mysql_log_service Struct Reference

#include <log_service.h>

Public Attributes

int(* run )(void *instance, log_line *ll)
 Have the service process one log line. More...
 
log_service_error(* flush )(void **instance)
 Flush any buffers. More...
 
log_service_error(* open )(log_line *ll, void **instance)
 Open a new instance. More...
 
log_service_error(* close )(void **instance)
 Close and release an instance. More...
 
int(* characteristics )(void)
 Get characteristics of a log-service. More...
 
log_service_error(* parse_log_line )(const char *line_start, size_t line_length)
 Parse a single line in an error log of this format. More...
 
log_service_error(* get_log_name )(void *instance, char *buf, size_t bufsize)
 Provide the name for a log file this service would access. More...
 

Member Data Documentation

◆ characteristics

int(* s_mysql_log_service::characteristics) (void)

Get characteristics of a log-service.

Return values
<0an error occurred
>=0characteristics (a set of log_service_chistics flags)

◆ close

log_service_error(* s_mysql_log_service::close) (void **instance)

Close and release an instance.

Flushes any buffers.

Parameters
instanceState-pointer that was returned on open. If memory was allocated for this state, it should be released, and the pointer set to nullptr.
Returns
LOG_SERVICE_SUCCESS success
otherwise an error occurred

◆ flush

log_service_error(* s_mysql_log_service::flush) (void **instance)

Flush any buffers.

This function will be called by the server on FLUSH ERROR LOGS. The service may write its buffers, close and re-open any log files to work with log-rotation, etc. The flush function MUST NOT itself log anything (as the caller holds THR_LOCK_log_stack)! A service implementation may provide a nullptr if it does not wish to provide a flush function.

Parameters
instanceState-pointer that was returned on open. Value may be changed in flush.
Returns
LOG_SERVICE_NOTHING_DONE no work was done
LOG_SERVICE_SUCCESS flush completed without incident
otherwise an error occurred

◆ get_log_name

log_service_error(* s_mysql_log_service::get_log_name) (void *instance, char *buf, size_t bufsize)

Provide the name for a log file this service would access.

Parameters
instanceinstance info returned by open() if requesting the file-name for a specific open instance. nullptr to get the name of the default instance (even if it that log is not open). This is used to determine the name of the log-file to load on start-up.
bufAddress of a buffer allocated in the caller. The callee may return an extension starting with '.', in which case the path and file-name will be the system's default, except with the given extension. Alternatively, the callee may return a file-name which is assumed to be in the same directory as the default log. Values are C-strings.
bufsizeThe size of the allocation in the caller.
Return values
0Success
-1Mode not supported (only default / only instances supported)
-2Buffer not large enough
-3Misc. error

◆ open

log_service_error(* s_mysql_log_service::open) (log_line *ll, void **instance)

Open a new instance.

Parameters
lloptional arguments
instanceIf state is needed, the service may allocate and initialize it and return a pointer to it here. (This of course is particularly pertinent to components that may be opened multiple times, such as the JSON log writer.) This state is for use of the log-service component in question only and can take any layout suitable to that component's need. The state is opaque to the server/logging framework. It must be released on close.
Returns
LOG_SERVICE_SUCCESS success, returned handle is valid
otherwise a new instance could not be created

◆ parse_log_line

log_service_error(* s_mysql_log_service::parse_log_line) (const char *line_start, size_t line_length)

Parse a single line in an error log of this format.

(optional)

Parameters
line_startpointer to the beginning of the line ('{')
line_lengthlength of the line
Return values
0Success
!=0Failure (out of memory, malformed argument, etc.)

◆ run

int(* s_mysql_log_service::run) (void *instance, log_line *ll)

Have the service process one log line.

Parameters
instanceState-pointer that was returned on open.
llThe log_line collection of log_items.
Return values
<0an error occurred
=0no work was done
>0number of processed entities

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