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