MySQL 9.1.0
Source Code Documentation
xcom_logger.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef XCOM_LOGGER_H
25#define XCOM_LOGGER_H
26
27#ifdef HAVE_STDINT_H
28#include <stdint.h>
29#endif
30
31#include "xcom/x_platform.h"
32/*
33 Log levels definition for use without external logger. Note that this can
34 only be changed in lock-step with GCS. Otherwise, things will break when
35 XCOM is used along with GCS.
36
37*/
38typedef enum {
44
45static const char *const xcom_log_levels[] = {
46 "[MYSQL_XCOM_FATAL] ", "[MYSQL_XCOM_ERROR] ", "[MYSQL_XCOM_WARN] ",
47 "[MYSQL_XCOM_INFO] "};
48
49/*
50Debug options that are defined for use without external debugger. Note that
51this can only be changed in lock-step with GCS. Otherwise, things will break
52when XCOM is used along with GCS.
53
54Assuming that we are not using all bits available to define a debug level,
55GCS_INVALID_DEBUG will give us the last possible entry that is not used.
56
57The GCS_DEBUG_NONE, GCS_DEBUG_ALL and GCS_INVALID_DEBUG are options that apply
58to both GCS and XCOM but we don't prefix it with XCOM to avoid big names.
59*/
60#if !defined(GCS_XCOM_DEBUG_INFORMATION)
61#define GCS_XCOM_DEBUG_INFORMATION
62typedef enum {
63 GCS_DEBUG_NONE = 0x00000000,
64 GCS_DEBUG_BASIC = 0x00000001,
65 GCS_DEBUG_TRACE = 0x00000002,
66 XCOM_DEBUG_BASIC = 0x00000004,
67 XCOM_DEBUG_TRACE = 0x00000008,
68 GCS_DEBUG_MSG_FLOW = 0x00000010,
69 XCOM_DEBUG_MSG_FLOW = 0x00000020,
70 GCS_INVALID_DEBUG = ~(0x7FFFFFFF),
73
74#endif
75
76typedef void (*xcom_logger)(const int64_t level, const char *message);
77typedef void (*xcom_debugger)(const char *format, ...)
78 MY_ATTRIBUTE((format(printf, 1, 2)));
79typedef int (*xcom_debugger_check)(const int64_t debug_options);
80#endif
int(* xcom_debugger_check)(const int64_t debug_options)
Definition: xcom_logger.h:79
void(* xcom_debugger)(const char *format,...)
Definition: xcom_logger.h:77
static const char *const xcom_log_levels[]
Definition: xcom_logger.h:45
xcom_log_level_t
Definition: xcom_logger.h:38
@ XCOM_LOG_INFO
Definition: xcom_logger.h:42
@ XCOM_LOG_ERROR
Definition: xcom_logger.h:40
@ XCOM_LOG_FATAL
Definition: xcom_logger.h:39
@ XCOM_LOG_WARN
Definition: xcom_logger.h:41
gcs_xcom_debug_option_t
Definition: xcom_logger.h:62
@ XCOM_DEBUG_TRACE
Definition: xcom_logger.h:67
@ GCS_DEBUG_TRACE
Definition: xcom_logger.h:65
@ GCS_INVALID_DEBUG
Definition: xcom_logger.h:70
@ GCS_DEBUG_MSG_FLOW
Definition: xcom_logger.h:68
@ GCS_DEBUG_ALL
Definition: xcom_logger.h:71
@ XCOM_DEBUG_MSG_FLOW
Definition: xcom_logger.h:69
@ GCS_DEBUG_BASIC
Definition: xcom_logger.h:64
@ XCOM_DEBUG_BASIC
Definition: xcom_logger.h:66
@ GCS_DEBUG_NONE
Definition: xcom_logger.h:63
void(* xcom_logger)(const int64_t level, const char *message)
Definition: xcom_logger.h:76