MySQL  8.0.22
Source Code Documentation
xcom_logger.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 2020, 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 #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 */
37 typedef enum {
43 
44 static const char *const xcom_log_levels[] = {
45  "[MYSQL_XCOM_FATAL] ", "[MYSQL_XCOM_ERROR] ", "[MYSQL_XCOM_WARN] ",
46  "[MYSQL_XCOM_INFO] "};
47 
48 /*
49 Debug options that are defined for use without external debugger. Note that
50 this can only be changed in lock-step with GCS. Otherwise, things will break
51 when XCOM is used along with GCS.
52 
53 Assuming that we are not using all bits available to define a debug level,
54 GCS_INVALID_DEBUG will give us the last possible entry that is not used.
55 
56 The GCS_DEBUG_NONE, GCS_DEBUG_ALL and GCS_INVALID_DEBUG are options that apply
57 to 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
61 typedef 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 
75 typedef void (*xcom_logger)(const int64_t level, const char *message);
76 typedef void (*xcom_debugger)(const char *format, ...)
77  MY_ATTRIBUTE((format(printf, 1, 2)));
78 typedef int (*xcom_debugger_check)(const int64_t debug_options);
79 #endif
Definition: xcom_logger.h:63
gcs_xcom_debug_option_t
Definition: xcom_logger.h:61
Definition: xcom_logger.h:41
Definition: xcom_logger.h:40
Definition: xcom_logger.h:69
xcom_log_level_t
Definition: xcom_logger.h:37
Definition: xcom_logger.h:66
void(* xcom_debugger)(const char *format,...)
Definition: xcom_logger.h:76
Definition: xcom_logger.h:68
Definition: xcom_logger.h:62
Definition: xcom_logger.h:65
Definition: xcom_logger.h:64
Definition: xcom_logger.h:67
Definition: xcom_logger.h:38
Definition: xcom_logger.h:70
static const char *const xcom_log_levels[]
Definition: xcom_logger.h:44
int(* xcom_debugger_check)(const int64_t debug_options)
Definition: xcom_logger.h:78
void(* xcom_logger)(const int64_t level, const char *message)
Definition: xcom_logger.h:75
Definition: xcom_logger.h:39