MySQL 9.6.0
Source Code Documentation
gcs_basic_logging.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2025, 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
28
29extern void cb_xcom_logger(const int64_t level, const char *message);
30extern void cb_xcom_debugger(const char *format, ...);
31extern int cb_xcom_debugger_check(const int64_t options);
32
33/**
34 Class that defines basic logging infra-structure to be used in the test
35 cases, for example.
36*/
38 public:
39 /*
40 Pointer to a logger object that is responsible for handling fatal, error,
41 warning and information messages.
42 */
44
45 /*
46 Pointer to a debugger object that is responsible for handling debug and
47 trace messages.
48 */
50
51 /*
52 Pointer to a sink where both the messages produced by a logger or debugger
53 will be written to. This is a simple logging infra-structure and messages
54 are always written to the standard output.
55 */
57
58 /*
59 Save debug options that will be restored when the object is destructed.
60 */
62
63 /*
64 The clock timestamp provider.
65 */
66 std::shared_ptr<Gcs_clock_timestamp_provider> m_clock_timestamp_provider;
67
68 /**
69 Constructor that creates the logger, debugger and sink.
70 */
72 : logger(nullptr),
78
80
83
85 std::make_shared<Gcs_clock_timestamp_provider>();
86 m_clock_timestamp_provider->initialize();
89
93
95 }
96
97 /**
98 Destructor that cleans up and deallocates the logger, debugger and sink.
99 */
102 logger->finalize();
103 delete logger;
104
107 delete debugger;
108
109 m_clock_timestamp_provider->finalize();
110
111 sink->finalize();
112 delete sink;
113
115 }
116};
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
Circular buffer that can be used to asynchronously feed a sink.
Definition: gcs_logging_system.h:192
enum_gcs_error finalize()
Asynchronous circular buffer finalization method.
Definition: gcs_logging_system.cc:122
Class that defines basic logging infra-structure to be used in the test cases, for example.
Definition: gcs_basic_logging.h:37
Gcs_basic_logging()
Constructor that creates the logger, debugger and sink.
Definition: gcs_basic_logging.h:71
Gcs_default_debugger * debugger
Definition: gcs_basic_logging.h:49
Gcs_async_buffer * sink
Definition: gcs_basic_logging.h:56
std::shared_ptr< Gcs_clock_timestamp_provider > m_clock_timestamp_provider
Definition: gcs_basic_logging.h:66
Gcs_default_logger * logger
Definition: gcs_basic_logging.h:43
virtual ~Gcs_basic_logging()
Destructor that cleans up and deallocates the logger, debugger and sink.
Definition: gcs_basic_logging.h:100
int64_t saved_debug_options
Definition: gcs_basic_logging.h:61
static enum_gcs_error finalize()
Free any resource used in the debugging system.
Definition: gcs_logging_system.h:766
static enum_gcs_error initialize(Gcs_default_debugger *debugger)
Set the debugger object and initialize it by invoking its initialization method.
Definition: gcs_logging_system.h:747
static bool force_debug_options(const int64_t debug_options)
Change the current set of debug options by the new debug options expressed as an integer parameter.
Definition: gcs_logging.cc:203
static int64_t get_current_debug_options()
Get the current set of debug options.
Definition: gcs_logging.cc:88
Default debugger which is used only by GCS and XCOM.
Definition: gcs_logging_system.h:511
enum_gcs_error finalize()
Default debugger finalization method.
Definition: gcs_logging_system.cc:343
Default logger which is internally used by GCS and XCOM if nothing else is injected by Group Replicat...
Definition: gcs_logging_system.h:452
enum_gcs_error finalize() override
Default logger finalization method.
Definition: gcs_logging_system.cc:325
static enum_gcs_error finalize()
Free any resource used in the logging system.
Definition: gcs_logging.cc:44
static enum_gcs_error initialize(Logger_interface *logger)
Set the logger object and initialize it by invoking its initialization method.
Definition: gcs_logging.cc:39
Standard output sink.
Definition: gcs_logging_system.h:389
static int init_net()
Definition: gcs_xcom_utils.cc:126
int cb_xcom_debugger_check(const int64_t options)
Callback function used by XCOM to check whether a debug module is enabled or not.
Definition: gcs_xcom_interface.cc:1931
void cb_xcom_debugger(const char *format,...)
Callback function used by XCOM to write debug messages in coordination with the GCS layer.
Definition: gcs_xcom_interface.cc:1918
void cb_xcom_logger(const int64_t level, const char *message)
Callback function used by XCOM to write information, warning and error messages in coordination with ...
Definition: gcs_xcom_interface.cc:1899
@ GCS_DEBUG_ALL
Definition: gcs_logging.h:281
@ GCS_DEBUG_NONE
Definition: gcs_logging.h:273
std::string format(const routing_guidelines::Session_info &session_info, bool extended_session_info)
Definition: dest_metadata_cache.cc:170
Definition: options.cc:57
void set_xcom_logger(xcom_logger x)
Definition: xcom_interface.cc:106
void set_xcom_debugger_check(xcom_debugger_check x)
Definition: xcom_interface.cc:110
void set_xcom_debugger(xcom_debugger x)
Definition: xcom_interface.cc:108