MySQL 9.0.0
Source Code Documentation
logger_plugin.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018, 2024, 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
32#include "harness_export.h"
36#include "mysql/harness/plugin.h"
37
38constexpr const char *kLoggerPluginName = "logger";
39extern mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger;
40
41/**
42 * Creates the logging handler for each plugin from the configuration.
43 *
44 * @param config configuration containing the plugin names we should create
45 * loggers for
46 * @param registry logging registry where the logging handlers should be
47 * created
48 * @param level logging level for the newly create logging handlers
49 *
50 * @throws std::logic_error
51 */
52void HARNESS_EXPORT
56
57using on_switch_to_configured_loggers = std::function<void()>;
58
59/**
60 * Registers the callback that the plugin will execute once it is finished with
61 * initialization and switches from the default to the configured logger
62 * sink(s).
63 *
64 * @param callback callback to execute
65 */
68
69#endif
Configuration file handler for the loader.
Definition: loader_config.h:46
Definition: registry.h:47
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:305
constexpr const char * kLoggerPluginName
Definition: logger_plugin.h:38
mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger
Definition: logger_plugin.cc:566
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:280
std::function< void()> on_switch_to_configured_loggers
Definition: logger_plugin.h:57
Logging interface for using and extending the logging subsystem.
LogLevel
Log level values.
Definition: logging.h:90