MySQL 8.4.2
Source Code Documentation
logger_plugin.cc File Reference

Classes

class  anonymous_namespace{logger_plugin.cc}::LoggingPluginConfig
 
class  anonymous_namespace{logger_plugin.cc}::LoggerConfigExposer
 

Namespaces

namespace  anonymous_namespace{logger_plugin.cc}
 

Macros

#define MYSQL_ROUTER_LOG_DOMAIN   "logger"
 
#define NULL_DEVICE_NAME   "/dev/null"
 
#define STDOUT_DEVICE_NAME   "/dev/stdout"
 
#define STDERR_DEVICE_NAME   "/dev/stderr"
 
#define LEGAL_DESTINATION_DEVICE_NAMES    NULL_DEVICE_NAME ", " STDOUT_DEVICE_NAME ", " STDERR_DEVICE_NAME
 

Typedefs

using HandlerPtr = std::shared_ptr< mysql_harness::logging::Handler >
 
using LoggerHandlersList = std::vector< std::pair< std::string, HandlerPtr > >
 

Functions

static bool legal_consolelog_destination (const std::string &destination)
 
HandlerPtr anonymous_namespace{logger_plugin.cc}::create_logging_sink (const LoggingPluginConfig &config)
 
void 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. More...
 
void 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 switches from the default to the configured logger sink(s). More...
 
static bool get_sinks_from_config (const mysql_harness::LoaderConfig &config, std::vector< std::string > &out_sinks, std::string &out_default_log_filename, mysql_harness::logging::LogLevel &out_default_log_level, mysql_harness::logging::LogTimestampPrecision &out_default_log_timestamp_precision, std::string &out_err_msg)
 
static bool init_handlers (mysql_harness::PluginFuncEnv *env, const mysql_harness::LoaderConfig &config, LoggerHandlersList &logger_handlers)
 
static void switch_to_loggers_in_config (const mysql_harness::LoaderConfig &config, const LoggerHandlersList &logger_handlers)
 
static void init (mysql_harness::PluginFuncEnv *env)
 
static void expose_configuration (mysql_harness::PluginFuncEnv *env, const char *, bool initial)
 

Variables

std::vector< on_switch_to_configured_loggersg_on_switch_to_configured_loggers_clbs
 
mysql_harness::Plugin harness_plugin_logger
 

Macro Definition Documentation

◆ LEGAL_DESTINATION_DEVICE_NAMES

#define LEGAL_DESTINATION_DEVICE_NAMES    NULL_DEVICE_NAME ", " STDOUT_DEVICE_NAME ", " STDERR_DEVICE_NAME

◆ MYSQL_ROUTER_LOG_DOMAIN

#define MYSQL_ROUTER_LOG_DOMAIN   "logger"

◆ NULL_DEVICE_NAME

#define NULL_DEVICE_NAME   "/dev/null"

◆ STDERR_DEVICE_NAME

#define STDERR_DEVICE_NAME   "/dev/stderr"

◆ STDOUT_DEVICE_NAME

#define STDOUT_DEVICE_NAME   "/dev/stdout"

Typedef Documentation

◆ HandlerPtr

using HandlerPtr = std::shared_ptr<mysql_harness::logging::Handler>

◆ LoggerHandlersList

using LoggerHandlersList = std::vector<std::pair<std::string, HandlerPtr> >

Function Documentation

◆ create_plugin_loggers()

void 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.

Parameters
configconfiguration containing the plugin names we should create loggers for
registrylogging registry where the logging handlers should be created
levellogging level for the newly create logging handlers
Exceptions
std::logic_error

◆ expose_configuration()

static void expose_configuration ( mysql_harness::PluginFuncEnv env,
const char *  ,
bool  initial 
)
static

◆ get_sinks_from_config()

static bool get_sinks_from_config ( const mysql_harness::LoaderConfig config,
std::vector< std::string > &  out_sinks,
std::string &  out_default_log_filename,
mysql_harness::logging::LogLevel out_default_log_level,
mysql_harness::logging::LogTimestampPrecision out_default_log_timestamp_precision,
std::string &  out_err_msg 
)
static

◆ init()

static void init ( mysql_harness::PluginFuncEnv env)
static

◆ init_handlers()

static bool init_handlers ( mysql_harness::PluginFuncEnv env,
const mysql_harness::LoaderConfig config,
LoggerHandlersList logger_handlers 
)
static

◆ legal_consolelog_destination()

static bool legal_consolelog_destination ( const std::string &  destination)
inlinestatic

◆ register_on_switch_to_configured_loggers_callback()

void 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 switches from the default to the configured logger sink(s).

Parameters
callbackcallback to execute

◆ switch_to_loggers_in_config()

static void switch_to_loggers_in_config ( const mysql_harness::LoaderConfig config,
const LoggerHandlersList logger_handlers 
)
static

Variable Documentation

◆ g_on_switch_to_configured_loggers_clbs

std::vector<on_switch_to_configured_loggers> g_on_switch_to_configured_loggers_clbs

◆ harness_plugin_logger

mysql_harness::Plugin harness_plugin_logger
Initial value:
= {
mysql_harness::PLUGIN_ABI_VERSION,
mysql_harness::ARCHITECTURE_DESCRIPTOR,
"Logger",
VERSION_NUMBER(0, 0, 1),
0,
nullptr,
0,
nullptr,
init,
nullptr,
nullptr,
nullptr,
false,
}
static void expose_configuration(mysql_harness::PluginFuncEnv *env, const char *, bool initial)
Definition: logger_plugin.cc:533
static void init(mysql_harness::PluginFuncEnv *env)
Definition: logger_plugin.cc:478
static constexpr std::array< const char *, 5 > logger_supported_options
Definition: supported_logger_options.h:39