MySQL 8.3.0
Source Code Documentation
logger_plugin.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018, 2023, 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 also distributed 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 included with MySQL.
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 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*/
24
25#ifndef MYSQL_HARNESS_LOGGER_PLUGIN_INCLUDED
26#define MYSQL_HARNESS_LOGGER_PLUGIN_INCLUDED
27
28#include <array>
29#include <functional>
30
31#include "harness_export.h"
35#include "mysql/harness/plugin.h"
36
37constexpr const char *kLoggerPluginName = "logger";
38extern mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger;
39
40/**
41 * Creates the logging handler for each plugin from the configuration.
42 *
43 * @param config configuration containing the plugin names we should create
44 * loggers for
45 * @param registry logging registry where the logging handlers should be
46 * created
47 * @param level logging level for the newly create logging handlers
48 *
49 * @throws std::logic_error
50 */
51void HARNESS_EXPORT
55
56using on_switch_to_configured_loggers = std::function<void()>;
57
58/**
59 * Registers the callback that the plugin will execute once it is finished with
60 * initialization and switches from the default to the configured logger
61 * sink(s).
62 *
63 * @param callback callback to execute
64 */
67
68#endif
Configuration file handler for the loader.
Definition: loader_config.h:45
Definition: registry.h:46
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:269
constexpr const char * kLoggerPluginName
Definition: logger_plugin.h:37
mysql_harness::Plugin HARNESS_EXPORT harness_plugin_logger
Definition: logger_plugin.cc:441
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:244
std::function< void()> on_switch_to_configured_loggers
Definition: logger_plugin.h:56
Logging interface for using and extending the logging subsystem.
LogLevel
Log level values.
Definition: logging.h:95