24#ifndef LOG_BUILTINS_IMP_H
25#define LOG_BUILTINS_IMP_H
55#define LOG_BUILTINS_FILTER "log_filter_internal"
61#define LOG_BUILTINS_SINK "log_sink_internal"
66#define LOG_ERROR_SERVICES_DEFAULT LOG_BUILTINS_FILTER "; " LOG_BUILTINS_SINK
142 (
const char *
file,
void **my_errstream));
145 (
void *my_errstream,
const char *
buffer,
size_t length));
150 (
void **my_errstream));
153 (
const char *
file,
void **my_errstream));
169 (
const char *a,
const char *b,
size_t len,
170 bool case_insensitive));
173 (
char *to,
size_t n,
const char *fmt, va_list ap))
174 MY_ATTRIBUTE((
format(printf, 3, 0)));
177 (
char *to,
size_t n,
const char *fmt, ...))
178 MY_ATTRIBUTE((
format(printf, 3, 4)));
187 (
void *thd, uint severity, uint code,
char *to,
size_t n,
189 MY_ATTRIBUTE((
format(printf, 6, 7)));
198 (
const char *
name,
int option,
int facility));
200 (
enum loglevel level,
const char *msg));
Primitives for services to interact with the structured logger: functions pertaining to log_line and ...
Definition: log_builtins_imp.h:74
static log_item * line_item_iter_first(log_item_iter *it) noexcept
Use the log_line iterator to get the first item from the set.
Definition: log_builtins.cc:2797
static log_item_iter * line_item_iter_acquire(log_line *ll) noexcept
Get an iterator for the items in a log_line.
Definition: log_builtins.cc:2764
static int item_inconsistent(log_item *li) noexcept
Sanity check an item.
Definition: log_builtins.cc:2433
static longlong errcode_by_errsymbol(const char *sym) noexcept
Return MySQL error code for a given error symbol.
Definition: log_builtins.cc:3013
static bool item_string_class(log_item_class c) noexcept
Predicate used to determine whether a class is a string class (C-string or Lex-string).
Definition: log_builtins.cc:2460
static log_item_data * item_set(log_item *li, log_item_type t) noexcept
As log_item_set_with_key(), except that the key is automatically derived from the wellknown log_item_...
Definition: log_builtins.cc:2620
static void line_set_flag(log_line *ll, log_line_flags_mask mask, log_line_flags_mask value) noexcept
Set/reset one or more log line flags.
Definition: log_builtins.cc:2544
static int line_submit(log_line *ll) noexcept
Complete, filter, and write submitted log items.
Definition: log_builtins.cc:2867
static log_item * line_item_iter_next(log_item_iter *it) noexcept
Use the log_line iterator to get the next item from the set.
Definition: log_builtins.cc:2816
static int dedicated_errstream(void *my_errstream) noexcept
Are we writing to a dedicated errstream, or are we sharing it?
Definition: log_builtins.cc:3259
static log_service_error open_errstream(const char *file, void **my_errstream) noexcept
Open an error log file.
Definition: log_builtins.cc:3141
static bool item_set_lexstring(log_item_data *lid, const char *s, size_t s_len) noexcept
Definition: log_builtins.cc:2510
static log_item * line_get_output_buffer(log_line *ll) noexcept
Get log-line's output buffer.
Definition: log_builtins.cc:2751
static int wellknown_by_name(const char *key, size_t length) noexcept
See whether a string is a wellknown field name.
Definition: log_builtins.cc:2387
static log_service_error write_errstream(void *my_errstream, const char *buffer, size_t length) noexcept
Write to an error log file previously opened with open_errstream().
Definition: log_builtins.cc:3234
static const char * wellknown_get_name(uint i) noexcept
Accessor: from a record describing a wellknown key, get its name.
Definition: log_builtins.cc:2409
static int sanitize(log_item *li) noexcept
Definition: log_builtins.cc:2926
static bool item_generic_type(log_item_type t) noexcept
Predicate used to determine whether a type is generic (generic string, generic float,...
Definition: log_builtins.cc:2447
static bool item_numeric_class(log_item_class c) noexcept
Predicate used to determine whether a class is a numeric class (integer or float).
Definition: log_builtins.cc:2473
static log_service_error close_errstream(void **my_errstream) noexcept
Close an error log file previously opened with open_errstream() (wrapper for the component system).
Definition: log_builtins.cc:3322
static log_item_data * item_set_with_key(log_item *li, log_item_type t, const char *key, uint32 alloc) noexcept
Create new log item with key name "key", and allocation flags of "alloc" (see enum_log_item_free).
Definition: log_builtins.cc:2584
static int message(int log_type,...) noexcept
Submit a log-message for log "log_type".
Definition: log_builtins.cc:2906
static const char * label_from_prio(int prio) noexcept
Convenience function: Derive a log label ("error", "warning", "information") from a severity.
Definition: log_builtins.cc:3028
static bool item_set_cstring(log_item_data *lid, const char *s) noexcept
Set a string value on a log_item.
Definition: log_builtins.cc:2526
static log_line * line_init() noexcept
Dynamically allocate and initialize a log_line.
Definition: log_builtins.cc:2700
static void line_item_iter_release(log_item_iter *it) noexcept
Release an iterator for the items in a log_line.
Definition: log_builtins.cc:2782
static bool item_set_int(log_item_data *lid, longlong i) noexcept
Set an integer value on a log_item.
Definition: log_builtins.cc:2489
static void line_exit(log_line *ll) noexcept
Release a log_line allocated with line_init()
Definition: log_builtins.cc:2709
static ulonglong parse_iso8601_timestamp(const char *timestamp, size_t len) noexcept
Parse a ISO8601 timestamp and return the number of microseconds since the epoch.
Definition: log_builtins.cc:3044
static bool item_set_float(log_item_data *lid, double f) noexcept
Set a floating point value on a log_item.
Definition: log_builtins.cc:2505
static log_item_data * line_item_set_with_key(log_line *ll, log_item_type t, const char *key, uint32 alloc) noexcept
Create new log item in log line "ll", with key name "key", and allocation flags of "alloc" (see enum_...
Definition: log_builtins.cc:2659
static const char * errmsg_by_errcode(int mysql_errcode) noexcept
Return MySQL error message for a given error code.
Definition: log_builtins.cc:3000
static log_item_type_mask line_item_types_seen(log_line *ll, log_item_type_mask m) noexcept
Test whether a given type is presumed present on the log line.
Definition: log_builtins.cc:2734
static int line_item_count(log_line *ll) noexcept
How many items are currently set on the given log_line?
Definition: log_builtins.cc:2720
static log_service_error reopen_errstream(const char *file, void **my_errstream) noexcept
Re-open an error log file (primarily to facilitate flush/log-rotation)
Definition: log_builtins.cc:3356
static log_item_data * line_item_set(log_line *ll, log_item_type t) noexcept
Create a new log item of well-known type "t" in log line "ll".
Definition: log_builtins.cc:2690
static int wellknown_by_type(log_item_type t) noexcept
See whether a type is wellknown.
Definition: log_builtins.cc:2372
static log_item * line_item_iter_current(log_item_iter *it) noexcept
Use the log_line iterator to get the current item from the set.
Definition: log_builtins.cc:2836
static log_item_type wellknown_get_type(uint i) noexcept
Accessor: from a record describing a wellknown key, get its type.
Definition: log_builtins.cc:2398
String primitives for logging services.
Definition: log_builtins_imp.h:159
static size_t length(const char *s) noexcept
Wrapper for strlen(): length of a nul-terminated byte string.
Definition: log_builtins.cc:3458
static size_t substitutev(char *to, size_t n, const char *fmt, va_list ap) noexcept
Wrapper for vsnprintf(): Replace all % in format string with variables from list.
Definition: log_builtins.cc:3518
static char * find_last(const char *s, int c) noexcept
Wrapper for strrchr(): find character in string, from the right.
Definition: log_builtins.cc:3474
static char * strndup(const char *fm, size_t len) noexcept
Wrapper for my_strndup(): Alloc (len+1) bytes, then copy len bytes from fm, and \0 terminate.
Definition: log_builtins.cc:3444
static int compare(const char *a, const char *b, size_t len, bool case_insensitive) noexcept
Compare two NUL-terminated byte strings.
Definition: log_builtins.cc:3502
static size_t substitute(char *to, size_t n, const char *fmt,...) noexcept
Wrapper for vsnprintf(): Replace all % in format string with variables from list.
Definition: log_builtins.cc:3527
static void * malloc(size_t len) noexcept
Wrapper for my_malloc(): Alloc (len+1) bytes.
Definition: log_builtins.cc:3431
static void free(void *ptr) noexcept
Wrapper for my_free(): free allocated memory.
Definition: log_builtins.cc:3451
static char * find_first(const char *s, int c) noexcept
Wrapper for strchr(): find character in string, from the left.
Definition: log_builtins.cc:3466
Syslog/Eventlog functions for logging services.
Definition: log_builtins_imp.h:195
static log_service_error open(const char *name, int option, int facility) noexcept
Wrapper for mysys' my_openlog.
Definition: log_builtins.cc:3584
static log_service_error close(void) noexcept
Wrapper for mysys' my_closelog.
Definition: log_builtins.cc:3635
static log_service_error write(enum loglevel level, const char *msg) noexcept
Wrapper for mysys' my_syslog.
Definition: log_builtins.cc:3618
Temporary primitives for logging services.
Definition: log_builtins_imp.h:184
static size_t notify_client(void *thd, uint severity, uint code, char *to, size_t n, const char *format,...) noexcept
Definition: log_builtins.cc:3544
enum enum_log_service_error log_service_error
Error codes.
uint64 log_line_flags_mask
a bit mask with flags describing a log line
Definition: log_shared.h:231
enum enum_log_item_class log_item_class
enum enum_log_item_type log_item_type
item_type – what to log
uint64 log_item_type_mask
a bit mask of log_types.
Definition: log_shared.h:222
static int log_type
Definition: mi_log.cc:47
static mi_bit_type mask[]
Definition: mi_packrec.cc:141
unsigned long long int ulonglong
Definition: my_inttypes.h:56
long long int longlong
Definition: my_inttypes.h:55
uint32_t uint32
Definition: my_inttypes.h:67
loglevel
Definition: my_loglevel.h:41
constexpr value_type timestamp
Definition: classic_protocol_constants.h:278
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
required string key
Definition: replication_asynchronous_connection_failover.proto:60
#define DEFINE_METHOD(retval, name, args)
A macro to ensure method implementation has required properties, that is it does not throw exceptions...
Definition: service_implementation.h:79
case opt name
Definition: sslopt-case.h:29
Iterator over the key/value pairs of a log_line.
Definition: keyring_log_builtins_definition.cc:64
Definition: log_shared.h:202
log_line ("log event")
Definition: keyring_log_builtins_definition.cc:72
Definition: log_shared.h:191
int n
Definition: xcom_base.cc:509