MySQL 9.1.0
Source Code Documentation
keyring_log_builtins_definition.cc File Reference
#include <time.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <locale>
#include <memory>
#include <sstream>
#include <string_with_len.h>
#include <components/keyrings/common/component_helpers/include/keyring_log_builtins_definition.h>

Classes

struct  st_error
 Error structure. More...
 
struct  _log_item_iter
 Iterator over the key/value pairs of a log_line. More...
 
struct  _log_line
 log_line ("log event") More...
 
struct  _log_item_wellknown_key
 Pre-defined "well-known" keys, as opposed to ad hoc ones, for key/value pairs in logging. More...
 

Namespaces

namespace  keyring_common
 
namespace  keyring_common::service_definition
 

Macros

#define LOG_ITEM_MAX   64
 Maximum number of key/value pairs in a log event. More...
 

Typedefs

typedef struct _log_item_iter log_item_iter
 Iterator over the key/value pairs of a log_line. More...
 
typedef struct _log_line log_line
 log_line ("log event") More...
 
typedef struct _log_item_wellknown_key log_item_wellknown_key
 Pre-defined "well-known" keys, as opposed to ad hoc ones, for key/value pairs in logging. More...
 

Functions

static int log_item_wellknown_by_type (log_item_type t)
 Check if we know about the item type. More...
 
static const char * log_label_from_prio (int prio)
 Convenience function: Derive a log label ("error", "warning", "information") from a severity. More...
 
static log_item_datakr_line_item_set_with_key (log_line *ll, log_item_type t, const char *k, uint32 alloc)
 Base for line_item_set[_with_key]. More...
 
static void kr_log_item_free (log_item *li)
 Release any of key and value on a log-item that were dynamically allocated. More...
 
static void kr_log_line_item_free_all (log_line *ll)
 Release all log line items (key/value pairs) in log line ll. More...
 

Variables

static st_error global_error_names []
 Error info - generated from error message file. More...
 
static constexpr log_item_wellknown_key log_item_wellknown_keys []
 Required items and their type - See LogComponentErr. More...
 
static uint log_item_wellknown_keys_count
 

Macro Definition Documentation

◆ LOG_ITEM_MAX

#define LOG_ITEM_MAX   64

Maximum number of key/value pairs in a log event.

May be changed or abolished later.

Typedef Documentation

◆ log_item_iter

typedef struct _log_item_iter log_item_iter

Iterator over the key/value pairs of a log_line.

At present, only one iter may exist per log_line.

◆ log_item_wellknown_key

Pre-defined "well-known" keys, as opposed to ad hoc ones, for key/value pairs in logging.

◆ log_line

typedef struct _log_line log_line

log_line ("log event")

Function Documentation

◆ kr_line_item_set_with_key()

static log_item_data * kr_line_item_set_with_key ( log_line ll,
log_item_type  t,
const char *  k,
uint32  alloc 
)
static

Base for line_item_set[_with_key].

Stripped down version of that in log_builtins.cc.

◆ kr_log_item_free()

static void kr_log_item_free ( log_item li)
static

Release any of key and value on a log-item that were dynamically allocated.

Parameters
lilog-item to release the payload of

◆ kr_log_line_item_free_all()

static void kr_log_line_item_free_all ( log_line ll)
static

Release all log line items (key/value pairs) in log line ll.

This frees whichever keys and values were dynamically allocated.

Parameters
lllog_line

◆ log_item_wellknown_by_type()

static int log_item_wellknown_by_type ( log_item_type  t)
static

Check if we know about the item type.

◆ log_label_from_prio()

static const char * log_label_from_prio ( int  prio)
static

Convenience function: Derive a log label ("error", "warning", "information") from a severity.

Parameters
priothe severity/prio in question
Returns
a label corresponding to that priority.
Return values
Systemfor prio of SYSTEM_LEVEL
Errorfor prio of ERROR_LEVEL
Warningfor prio of WARNING_LEVEL
Notefor prio of INFORMATION_LEVEL

Variable Documentation

◆ global_error_names

st_error global_error_names[]
static
Initial value:
= {
{nullptr, 0, nullptr, nullptr, nullptr, 0}}

Error info - generated from error message file.

◆ log_item_wellknown_keys

constexpr log_item_wellknown_key log_item_wellknown_keys[]
staticconstexpr
Initial value:
= {
@ LOG_ITEM_SRV_COMPONENT
log called from component ...
Definition: log_shared.h:136
@ LOG_ITEM_SRC_FUNC
log called from function ...
Definition: log_shared.h:134
@ LOG_ITEM_SRC_FILE
log called from file ...
Definition: log_shared.h:132
@ LOG_ITEM_LOG_MESSAGE
the message, format string
Definition: log_shared.h:145
@ LOG_ITEM_LOG_PRIO
log priority (error, warn, ...)
Definition: log_shared.h:142
@ LOG_ITEM_SRV_SUBSYS
log called from subsystem ...
Definition: log_shared.h:135
@ LOG_ITEM_SQL_ERRCODE
mysql error code (numeric)
Definition: log_shared.h:127
@ LOG_ITEM_SRC_LINE
log called from line ...
Definition: log_shared.h:133
@ LOG_CSTRING
string (char * + \0; variadic API only)
Definition: log_shared.h:175
@ LOG_INTEGER
integer (long long)
Definition: log_shared.h:176
#define STRING_WITH_LEN(X)
Definition: string_with_len.h:29

Required items and their type - See LogComponentErr.

◆ log_item_wellknown_keys_count

uint log_item_wellknown_keys_count
static
Initial value:
=
static constexpr log_item_wellknown_key log_item_wellknown_keys[]
Required items and their type - See LogComponentErr.
Definition: keyring_log_builtins_definition.cc:92
Pre-defined "well-known" keys, as opposed to ad hoc ones, for key/value pairs in logging.
Definition: keyring_log_builtins_definition.cc:84