25#ifndef MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
26#define MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
28#include "harness_export.h"
77 void remove_logger(
const std::string &
name);
88 Logger get_logger(
const std::string &
name)
const;
101 Logger get_logger_or_default(
const std::string &
name,
102 const std::string &default_name)
const;
120 std::set<std::string> get_logger_names()
const;
134 void add_handler(std::string
name, std::shared_ptr<Handler>
handler);
143 void remove_handler(std::string
name);
152 std::shared_ptr<Handler> get_handler(
const std::string &
name)
const;
157 std::set<std::string> get_handler_names()
const;
166 bool is_handled(
LogLevel level)
const;
192 void flush_all_loggers(
const std::string dst =
"");
197 std::map<std::string, std::shared_ptr<Handler>>
199 std::atomic<bool> ready_{
false};
331 const std::list<std::string> &modules,
332 const std::string &main_app_log_domain);
347 const std::string &logger_name);
374 const std::string &logging_folder,
375 bool format_messages,
bool use_os_log =
false);
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4460
Configuration.
Definition: config_parser.h:252
Logger class.
Definition: logger.h:48
Definition: registry.h:46
bool is_ready() const noexcept
Query if logging facility is ready to use.
Definition: registry.h:185
Registry(const Registry &)=delete
void set_ready() noexcept
Flag that the registry has been initialized.
Definition: registry.h:177
std::mutex mtx_
Definition: registry.h:195
std::map< std::string, Logger > loggers_
Definition: registry.h:196
Registry & operator=(const Registry &)=delete
std::map< std::string, std::shared_ptr< Handler > > handlers_
Definition: registry.h:198
Logging interface for using and extending the logging subsystem.
HARNESS_EXPORT LogTimestampPrecision log_timestamp_precision_from_string(std::string name)
Converts string with log timestamp precision description to LogTimestampPrecision type.
Definition: registry.cc:417
HARNESS_EXPORT void set_log_level_for_all_handlers(const Registry ®istry, LogLevel level)
Set log levels for all handlers to specified value.
Definition: registry.cc:259
HARNESS_EXPORT LogLevel log_level_from_string(std::string name)
Converts string with log level description to LogLevel type.
Definition: registry.cc:351
LogLevel
Log level values.
Definition: logging.h:95
HARNESS_EXPORT void set_timestamp_precision_for_all_loggers(Registry ®istry, LogTimestampPrecision precision)
Set timestamp precision for all the loggers.
Definition: registry.cc:266
HARNESS_EXPORT void register_handler(std::string name, std::shared_ptr< Handler > handler)
Register handler for all plugins.
Definition: registry.cc:469
HARNESS_EXPORT std::string get_default_log_filename(const Config &config)
Get default log filename.
Definition: registry.cc:395
HARNESS_EXPORT void clear_registry(Registry ®istry)
Clear registry.
Definition: registry.cc:275
HARNESS_EXPORT LogLevel get_default_log_level(const Config &config, bool raw_mode=false)
Get default log level.
Definition: registry.cc:375
HARNESS_EXPORT void create_logger(Registry ®istry, const LogLevel level, const std::string &logger_name)
Definition: registry.cc:333
HARNESS_EXPORT void create_main_log_handler(Registry ®istry, const std::string &program, const std::string &logging_folder, bool format_messages, bool use_os_log=false)
Initialize logfile handler.
Definition: registry.cc:287
HARNESS_EXPORT void set_log_level_for_all_loggers(Registry ®istry, LogLevel level)
Set log levels for all the loggers to specified value.
Definition: registry.cc:251
HARNESS_EXPORT void unregister_handler(std::string name)
Unregister a handler.
Definition: registry.cc:476
HARNESS_EXPORT LogTimestampPrecision get_default_timestamp_precision(const Config &config)
Get default timestamp precision.
Definition: registry.cc:439
HARNESS_EXPORT std::ostream * get_default_logger_stream()
Returns pointer to the default logger sink stream.
Definition: registry.cc:285
LogTimestampPrecision
Log timestamp precision values.
Definition: logging.h:160
HARNESS_EXPORT void create_module_loggers(Registry ®istry, const LogLevel level, const std::list< std::string > &modules, const std::string &main_app_log_domain)
Initialize logging facility.
Definition: registry.cc:338
HARNESS_EXPORT void set_timestamp_precison_for_all_loggers(LogTimestampPrecision precision)
Set timestamp precision for all registered loggers.
HARNESS_EXPORT void attach_handler_to_all_loggers(Registry ®istry, std::string name)
Attach handler to all loggers.
Definition: registry.cc:241
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:295
case opt name
Definition: sslopt-case.h:32