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};
343 const std::list<std::string> &modules,
344 const std::string &main_app_log_domain);
359 const std::string &logger_name);
386 const std::string &logging_folder,
387 bool format_messages,
bool use_os_log =
false);
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4573
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.
static loglevel log_level(const Sql_condition *condition)
Definition: histogram.cc:1643
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:257
LogLevel
Log level values.
Definition: logging.h:90
HARNESS_EXPORT void set_timestamp_precision_for_all_loggers(Registry ®istry, LogTimestampPrecision precision)
Set timestamp precision for all the loggers.
Definition: registry.cc:264
HARNESS_EXPORT void register_handler(std::string name, std::shared_ptr< Handler > handler)
Register handler for all plugins.
Definition: registry.cc:483
HARNESS_EXPORT std::string get_default_log_filename(const Config &config)
Get default log filename.
Definition: registry.cc:401
HARNESS_EXPORT void clear_registry(Registry ®istry)
Clear registry.
Definition: registry.cc:273
HARNESS_EXPORT LogLevel get_default_log_level(const Config &config, bool raw_mode=false)
Get default log level.
Definition: registry.cc:382
HARNESS_EXPORT std::string log_timestamp_precision_to_string(LogTimestampPrecision tsp)
Definition: registry.cc:444
HARNESS_EXPORT void create_logger(Registry ®istry, const LogLevel level, const std::string &logger_name)
Definition: registry.cc:331
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:285
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:249
HARNESS_EXPORT void unregister_handler(std::string name)
Unregister a handler.
Definition: registry.cc:490
HARNESS_EXPORT LogTimestampPrecision get_default_timestamp_precision(const Config &config)
Get default timestamp precision.
Definition: registry.cc:453
HARNESS_EXPORT std::ostream * get_default_logger_stream()
Returns pointer to the default logger sink stream.
Definition: registry.cc:283
HARNESS_EXPORT LogLevel log_level_from_string(std::string name)
Converts string with log level description to LogLevel type.
Definition: registry.cc:348
LogTimestampPrecision
Log timestamp precision values.
Definition: logging.h:160
HARNESS_EXPORT std::string log_level_to_string(LogLevel log_level)
Converts LogLevel type to its string name.
Definition: registry.cc:372
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:336
HARNESS_EXPORT void set_timestamp_precison_for_all_loggers(LogTimestampPrecision precision)
Set timestamp precision for all registered loggers.
HARNESS_EXPORT LogTimestampPrecision log_timestamp_precision_from_string(std::string name)
Converts string with log timestamp precision description to LogTimestampPrecision type.
Definition: registry.cc:422
HARNESS_EXPORT void attach_handler_to_all_loggers(Registry ®istry, std::string name)
Attach handler to all loggers.
Definition: registry.cc:239
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:29