MySQL 9.1.0
Source Code Documentation
|
#include <mysql/mysql_lex_string.h>
#include "my_basename.h"
#include "my_inttypes.h"
#include "mysql/my_loglevel.h"
Go to the source code of this file.
Classes | |
union | _log_item_data |
struct | _log_item |
Macros | |
#define | LOG_TAG_DIAG "DIAGNOSTICS" |
DIAGNOSTICS: for da->message_text() More... | |
#define | LOG_TAG_AUX "AUX" |
AUX: supplementary data not fitting any of the wellknown keys. More... | |
#define | LOG_BUFF_MAX 8192 |
advisory. More... | |
#define | ER_SERVER_RANGE_START 10000 |
index of first server error message: messages with this index or higher are intended for the error log; messages below this index are intended for the client More... | |
Typedefs | |
typedef struct MYSQL_LEX_CSTRING | LEX_CSTRING |
fallback: includer may not have set this to something sensible. More... | |
typedef enum enum_log_item_type | log_item_type |
item_type – what to log More... | |
typedef enum enum_log_line_flags | log_line_flags |
Log line flags. More... | |
typedef enum enum_log_item_class | log_item_class |
typedef union _log_item_data | log_item_data |
typedef const char * | log_item_key |
typedef struct _log_item | log_item |
typedef enum enum_log_item_error | log_item_error |
typedef uint64 | log_item_type_mask |
a bit mask of log_types. More... | |
typedef struct _log_line | log_line |
log line: a collection of log items More... | |
typedef struct _log_item_iter | log_item_iter |
log iter: an iterator over the collection of log items in a log line More... | |
typedef uint64 | log_line_flags_mask |
a bit mask with flags describing a log line More... | |
Variables | |
static const int | iso8601_size = 33 |
size of a full ISO 8601 timestamp: More... | |
#define ER_SERVER_RANGE_START 10000 |
index of first server error message: messages with this index or higher are intended for the error log; messages below this index are intended for the client
#define LOG_BUFF_MAX 8192 |
advisory.
components must not rely on others using the same value.
#define LOG_TAG_AUX "AUX" |
AUX: supplementary data not fitting any of the wellknown keys.
#define LOG_TAG_DIAG "DIAGNOSTICS" |
DIAGNOSTICS: for da->message_text()
typedef struct MYSQL_LEX_CSTRING LEX_CSTRING |
fallback: includer may not have set this to something sensible.
The logging sub-system internally uses the log_line structure to pass data around. This header primarily the specifics and symbols of that structure.
Within the server, those interfaces may be used, but it is usually preferable to use the fluent C++ convenience class LogErr() instead where possible (and the variadic convenience function log_message() where it is not). (see sql/log.h).
Finally, this header defines log types (error log etc.) as well as log item types (timestamp, message, ...) used by the logging components; these are shared between the variadic convenience functions (log_message() etc.) as well as the lower level services using the log_line structure.
typedef enum enum_log_item_class log_item_class |
typedef union _log_item_data log_item_data |
typedef enum enum_log_item_error log_item_error |
typedef struct _log_item_iter log_item_iter |
log iter: an iterator over the collection of log items in a log line
typedef const char* log_item_key |
typedef enum enum_log_item_type log_item_type |
item_type – what to log
Used by variadic convenience interface log_message(), legacy sql_print_*(), legacy my_plugin_log_message(). Also available via the log_builtins service as message().
(Wherever possible, use the fluent C++ wrapper LogErr() (see log_builtins.h) instead, though.)
LOG_ITEM_GEN_CSTRING lets the caller submit a \0 terminated, C-style string for convenience; it will be converted to lex style (char *, size_t) on submission.
LOG_ITEM_END should not be used in the variadic interface as submitting a log line without an actual message is discouraged. Instead LOG_ITEM_LOG_MESSAGE or LOG_ITEM_LOG_LOOKUP should be used as the last LOG_ITEM_* key-value pairs:
In variadic submission, both ad hoc and well-known error messages are considered printf()-style format strings, and should be followed by any arguments/variables required by that format string.
In some situations, the variadic interface will automatically generate some items ("If you cannot afford a timestamp, one will be provided for you."). If an item of the required type already exists, the submission interface should not generate another.
Old-style plug-ins using my_plugin_log_message() will automatically be tagged with a default LOG_ITEM_MSC_COMPONENT of their plug-in name.
Non-variadic interface
In non-variadic submission (i.e. all functions accepting a log_line), LOG_ITEM_LOG_LOOKUP and LOG_ITEM_GEN_CSTRING are not valid item types, while LOG_ITEM_LOG_MESSAGE must already be a string literal (i.e. any substitutions must already have taken place).
typedef uint64 log_item_type_mask |
a bit mask of log_types.
standardizing the width to 64 bit.
typedef enum enum_log_line_flags log_line_flags |
Log line flags.
typedef uint64 log_line_flags_mask |
a bit mask with flags describing a log line
enum enum_log_item_class |
enum enum_log_item_error |
enum enum_log_item_free |
enum enum_log_item_type |
item_type – what to log
Used by variadic convenience interface log_message(), legacy sql_print_*(), legacy my_plugin_log_message(). Also available via the log_builtins service as message().
(Wherever possible, use the fluent C++ wrapper LogErr() (see log_builtins.h) instead, though.)
LOG_ITEM_GEN_CSTRING lets the caller submit a \0 terminated, C-style string for convenience; it will be converted to lex style (char *, size_t) on submission.
LOG_ITEM_END should not be used in the variadic interface as submitting a log line without an actual message is discouraged. Instead LOG_ITEM_LOG_MESSAGE or LOG_ITEM_LOG_LOOKUP should be used as the last LOG_ITEM_* key-value pairs:
In variadic submission, both ad hoc and well-known error messages are considered printf()-style format strings, and should be followed by any arguments/variables required by that format string.
In some situations, the variadic interface will automatically generate some items ("If you cannot afford a timestamp, one will be provided for you."). If an item of the required type already exists, the submission interface should not generate another.
Old-style plug-ins using my_plugin_log_message() will automatically be tagged with a default LOG_ITEM_MSC_COMPONENT of their plug-in name.
Non-variadic interface
In non-variadic submission (i.e. all functions accepting a log_line), LOG_ITEM_LOG_LOOKUP and LOG_ITEM_GEN_CSTRING are not valid item types, while LOG_ITEM_LOG_MESSAGE must already be a string literal (i.e. any substitutions must already have taken place).
enum enum_log_line_flags |
enum enum_log_type |
|
static |
size of a full ISO 8601 timestamp: