MySQL  8.0.19
Source Code Documentation
xcom_logger.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
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 /*
27  Log levels definition for use without external logger. Note that this can
28  only be changed in lock-step with GCS. Otherwise, things will break when
29  XCOM is used along with GCS.
30 
31 */
32 typedef enum {
38 
39 static const char *const xcom_log_levels[] = {
40  "[MYSQL_XCOM_FATAL] ",
41  "[MYSQL_XCOM_ERROR] ",
42  "[MYSQL_XCOM_WARN] ",
43  "[MYSQL_XCOM_INFO] ",
44 };
45 
46 /*
47 Debug options that are defined for use without external debugger. Note that
48 this can only be changed in lock-step with GCS. Otherwise, things will break
49 when XCOM is used along with GCS.
50 
51 Assuming that we are not using all bits available to define a debug level,
52 GCS_INVALID_DEBUG will give us the last possible entry that is not used.
53 
54 The GCS_DEBUG_NONE, GCS_DEBUG_ALL and GCS_INVALID_DEBUG are options that apply
55 to both GCS and XCOM but we don't prefix it with XCOM to avoid big names.
56 */
57 #if !defined(GCS_XCOM_DEBUG_INFORMATION)
58 #define GCS_XCOM_DEBUG_INFORMATION
59 typedef enum {
60  GCS_DEBUG_NONE = 0x00000000,
61  GCS_DEBUG_BASIC = 0x00000001,
62  GCS_DEBUG_TRACE = 0x00000002,
63  XCOM_DEBUG_BASIC = 0x00000004,
64  XCOM_DEBUG_TRACE = 0x00000008,
65  GCS_DEBUG_MSG_FLOW = 0x00000010,
66  XCOM_DEBUG_MSG_FLOW = 0x00000020,
67  GCS_INVALID_DEBUG = ~(0x7FFFFFFF),
70 
71 static const char *const gcs_xcom_debug_strings[] = {
72  "GCS_DEBUG_BASIC", "GCS_DEBUG_TRACE", "XCOM_DEBUG_BASIC",
73  "XCOM_DEBUG_TRACE", "GCS_DEBUG_MSG_FLOW", "XCOM_DEBUG_MSG_FLOW",
74  "GCS_DEBUG_ALL", "GCS_DEBUG_NONE",
75 };
76 #endif
77 
78 typedef void (*xcom_logger)(const int64_t level, const char *message);
79 typedef void (*xcom_debugger)(const char *format, ...)
80  MY_ATTRIBUTE((format(printf, 1, 2)));
81 typedef int (*xcom_debugger_check)(const int64_t debug_options);
82 #endif
xcom_log_levels
static const char *const xcom_log_levels[]
Definition: xcom_logger.h:39
XCOM_DEBUG_TRACE
@ XCOM_DEBUG_TRACE
Definition: xcom_logger.h:64
gcs_xcom_debug_strings
static const char *const gcs_xcom_debug_strings[]
Definition: xcom_logger.h:71
xcom_debugger_check
int(* xcom_debugger_check)(const int64_t debug_options)
Definition: xcom_logger.h:81
GCS_DEBUG_ALL
@ GCS_DEBUG_ALL
Definition: xcom_logger.h:68
xcom_logger
void(* xcom_logger)(const int64_t level, const char *message)
Definition: xcom_logger.h:78
GCS_DEBUG_MSG_FLOW
@ GCS_DEBUG_MSG_FLOW
Definition: xcom_logger.h:65
XCOM_LOG_INFO
@ XCOM_LOG_INFO
Definition: xcom_logger.h:36
XCOM_LOG_WARN
@ XCOM_LOG_WARN
Definition: xcom_logger.h:35
XCOM_DEBUG_MSG_FLOW
@ XCOM_DEBUG_MSG_FLOW
Definition: xcom_logger.h:66
GCS_DEBUG_BASIC
@ GCS_DEBUG_BASIC
Definition: xcom_logger.h:61
XCOM_LOG_FATAL
@ XCOM_LOG_FATAL
Definition: xcom_logger.h:33
GCS_DEBUG_TRACE
@ GCS_DEBUG_TRACE
Definition: xcom_logger.h:62
XCOM_LOG_ERROR
@ XCOM_LOG_ERROR
Definition: xcom_logger.h:34
gcs_xcom_debug_option_t
gcs_xcom_debug_option_t
Definition: xcom_logger.h:59
xcom_log_level_t
xcom_log_level_t
Definition: xcom_logger.h:32
xcom_debugger
void(* xcom_debugger)(const char *format,...)
Definition: xcom_logger.h:79
GCS_INVALID_DEBUG
@ GCS_INVALID_DEBUG
Definition: xcom_logger.h:67
GCS_DEBUG_NONE
@ GCS_DEBUG_NONE
Definition: xcom_logger.h:60
XCOM_DEBUG_BASIC
@ XCOM_DEBUG_BASIC
Definition: xcom_logger.h:63