26#ifndef MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
27#define MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
29#include "harness_export.h"
78 void remove_logger(
const std::string &
name);
89 Logger get_logger(
const std::string &
name)
const;
102 Logger get_logger_or_default(
const std::string &
name,
103 const std::string &default_name)
const;
121 std::set<std::string> get_logger_names()
const;
135 void add_handler(std::string
name, std::shared_ptr<Handler>
handler);
144 void remove_handler(std::string
name);
153 std::shared_ptr<Handler> get_handler(
const std::string &
name)
const;
158 std::set<std::string> get_handler_names()
const;
167 bool is_handled(
LogLevel level)
const;
193 void flush_all_loggers(
const std::string dst =
"");
198 std::map<std::string, std::shared_ptr<Handler>>
200 std::atomic<bool> ready_{
false};
332 const std::list<std::string> &modules,
333 const std::string &main_app_log_domain);
348 const std::string &logger_name);
375 const std::string &logging_folder,
376 bool format_messages,
bool use_os_log =
false);
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4414
Configuration.
Definition: config_parser.h:253
Logger class.
Definition: logger.h:49
Definition: registry.h:47
bool is_ready() const noexcept
Query if logging facility is ready to use.
Definition: registry.h:186
Registry(const Registry &)=delete
void set_ready() noexcept
Flag that the registry has been initialized.
Definition: registry.h:178
std::mutex mtx_
Definition: registry.h:196
std::map< std::string, Logger > loggers_
Definition: registry.h:197
Registry & operator=(const Registry &)=delete
std::map< std::string, std::shared_ptr< Handler > > handlers_
Definition: registry.h:199
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:418
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:260
HARNESS_EXPORT LogLevel log_level_from_string(std::string name)
Converts string with log level description to LogLevel type.
Definition: registry.cc:352
LogLevel
Log level values.
Definition: logging.h:96
HARNESS_EXPORT void set_timestamp_precision_for_all_loggers(Registry ®istry, LogTimestampPrecision precision)
Set timestamp precision for all the loggers.
Definition: registry.cc:267
HARNESS_EXPORT void register_handler(std::string name, std::shared_ptr< Handler > handler)
Register handler for all plugins.
Definition: registry.cc:470
HARNESS_EXPORT std::string get_default_log_filename(const Config &config)
Get default log filename.
Definition: registry.cc:396
HARNESS_EXPORT void clear_registry(Registry ®istry)
Clear registry.
Definition: registry.cc:276
HARNESS_EXPORT LogLevel get_default_log_level(const Config &config, bool raw_mode=false)
Get default log level.
Definition: registry.cc:376
HARNESS_EXPORT void create_logger(Registry ®istry, const LogLevel level, const std::string &logger_name)
Definition: registry.cc:334
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:288
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:252
HARNESS_EXPORT void unregister_handler(std::string name)
Unregister a handler.
Definition: registry.cc:477
HARNESS_EXPORT LogTimestampPrecision get_default_timestamp_precision(const Config &config)
Get default timestamp precision.
Definition: registry.cc:440
HARNESS_EXPORT std::ostream * get_default_logger_stream()
Returns pointer to the default logger sink stream.
Definition: registry.cc:286
LogTimestampPrecision
Log timestamp precision values.
Definition: logging.h:161
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:339
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:242
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:296
case opt name
Definition: sslopt-case.h:33