MySQL 9.4.0
Source Code Documentation
logger_plugin.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018, 2025, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef MYSQL_HARNESS_LOGGER_PLUGIN_INCLUDED
27#define MYSQL_HARNESS_LOGGER_PLUGIN_INCLUDED
28
29#include <array>
30#include <functional>
31#include <set>
32
33#include "harness_export.h"
37#include "mysql/harness/plugin.h"
38
39constexpr const char *kLoggerPluginName = "logger";
40extern mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger;
41
42/**
43 * Creates the logging handler for each plugin from the configuration.
44 *
45 * @param config configuration containing the plugin names we should create
46 * loggers for
47 * @param registry logging registry where the logging handlers should be
48 * created
49 * @param level logging level for the newly create logging handlers
50 *
51 * @throws std::logic_error On error.
52 */
53void HARNESS_EXPORT
57
58using on_switch_to_configured_loggers = std::function<void()>;
59
60/**
61 * Registers the callback that the plugin will execute once it is finished with
62 * initialization and switches from the default to the configured logger
63 * sink(s).
64 *
65 * @param callback callback to execute
66 */
69
71 const std::set<std::string> &names);
72
73void HARNESS_EXPORT register_external_logging_handler(
74 const std::string &name,
75 std::shared_ptr<mysql_harness::logging::ExternalHandler> handler);
76
77void HARNESS_EXPORT
79
80#endif
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4666
Configuration file handler for the loader.
Definition: loader_config.h:46
Definition: registry.h:48
void HARNESS_EXPORT register_supported_external_logging_handler_names(const std::set< std::string > &names)
Definition: logger_plugin.cc:328
void HARNESS_EXPORT register_on_switch_to_configured_loggers_callback(on_switch_to_configured_loggers callback)
Registers the callback that the plugin will execute once it is finished with initialization and switc...
Definition: logger_plugin.cc:323
constexpr const char * kLoggerPluginName
Definition: logger_plugin.h:39
mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger
Definition: logger_plugin.cc:614
void HARNESS_EXPORT register_external_logging_handler(const std::string &name, std::shared_ptr< mysql_harness::logging::ExternalHandler > handler)
Definition: logger_plugin.cc:333
void HARNESS_EXPORT unregister_external_logging_handler(const std::string &name)
Definition: logger_plugin.cc:351
void HARNESS_EXPORT create_plugin_loggers(const mysql_harness::LoaderConfig &config, mysql_harness::logging::Registry &registry, const mysql_harness::logging::LogLevel level)
Creates the logging handler for each plugin from the configuration.
Definition: logger_plugin.cc:298
std::function< void()> on_switch_to_configured_loggers
Definition: logger_plugin.h:58
Logging interface for using and extending the logging subsystem.
LogLevel
Log level values.
Definition: logging.h:90
case opt name
Definition: sslopt-case.h:29