MySQL 8.0.39
Source Code Documentation
|
The built-in log-sink (i.e. More...
#include "log_sink_trad.h"
#include "log_sink_perfschema.h"
#include "my_systime.h"
#include "sql/log.h"
Functions | |
int | log_item_inconsistent (log_item *li) |
Sanity check an item. More... | |
ssize_t | parse_trad_field (const char *parse_from, const char **token_end, const char *buf_end) |
Find the end of the current field (' ') More... | |
log_service_error | log_sink_trad_parse_log_line (const char *line_start, size_t line_length) |
Parse a single line in the traditional error log. More... | |
int | log_sink_trad (void *instance, log_line *ll) |
services: log sinks: basic logging ("classic error-log") Will write timestamp, label, thread-ID, and message to stderr/file. More... | |
The built-in log-sink (i.e.
the writer for the traditional MySQL error log):
a) writing of an error log event to the traditional error log file b) parsing of a line from the traditional error log file
int log_item_inconsistent | ( | log_item * | li | ) |
Sanity check an item.
Certain log sinks have very low requirements with regard to the data they receive; they write keys as strings, and then data according to the item's class (string, integer, or float), formatted to the sink's standards (e.g. JSON, XML, ...). Code that has higher requirements can use this check to see whether the given item is of a known type (whether generic or wellknown), whether the given type and class agree, and whether in case of a well-known type, the given key is correct for that type. If your code generates items that don't pass this check, you should probably go meditate on it.
li | the log_item to check |
LOG_ITEM_OK | no problems |
LOG_ITEM_TYPE_NOT_FOUND | unknown item type |
LOG_ITEM_CLASS_MISMATCH | item_class derived from type isn't what's set on the item |
LOG_ITEM_KEY_MISMATCH | class not generic, so key should match wellknown |
LOG_ITEM_STRING_NULL | class is string, pointer is nullptr |
LOG_ITEM_KEY_NULL | no key set (this is legal e.g. on aux items of filter rules, but should not occur in a log_line, i.e., log_sinks are within their rights to discard such items) |
int log_sink_trad | ( | void * | instance, |
log_line * | ll | ||
) |
services: log sinks: basic logging ("classic error-log") Will write timestamp, label, thread-ID, and message to stderr/file.
If you should not be able to specify a label, one will be generated for you from the line's priority field.
instance | instance handle |
ll | the log line to write |
int | number of added fields, if any |
log_service_error log_sink_trad_parse_log_line | ( | const char * | line_start, |
size_t | line_length | ||
) |
Parse a single line in the traditional error log.
line_start | pointer to the beginning of the line ('2' of the ISO-date) |
line_length | length of the line |
LOG_SERVICE_ARGUMENT_TOO_LONG | Token too long for its field |
LOG_SERVICE_PARSE_ERROR | No more spaces in line, cannot find expected end of token, or input otherwise malformed |
LOG_SERVICE_SUCCESS | Event added to ring-buffer |
ssize_t parse_trad_field | ( | const char * | parse_from, |
const char ** | token_end, | ||
const char * | buf_end | ||
) |
Find the end of the current field (' ')
parse_from | start of the token |
token_end | where to store the address of the delimiter found |
buf_end | end of the input line |
-1 | delimiter not found, "parsing" failed |
>=0 | length of token |