25#ifndef MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
26#define MYSQL_HARNESS_LOGGER_REGISTRY_INCLUDED
28#include "harness_export.h"
49 const static std::map<std::string, LogTimestampPrecision>
81 void remove_logger(
const std::string &
name);
92 Logger get_logger(
const std::string &
name)
const;
105 Logger get_logger_or_default(
const std::string &
name,
106 const std::string &default_name)
const;
124 std::set<std::string> get_logger_names()
const;
138 void add_handler(std::string
name, std::shared_ptr<Handler>
handler);
147 void remove_handler(std::string
name);
156 std::shared_ptr<Handler> get_handler(
const std::string &
name)
const;
161 std::set<std::string> get_handler_names()
const;
170 bool is_handled(
LogLevel level)
const;
196 void flush_all_loggers(
const std::string dst =
"");
201 std::map<std::string, std::shared_ptr<Handler>>
203 std::atomic<bool> ready_{
false};
335 const std::list<std::string> &modules,
336 const std::string &main_app_log_domain);
351 const std::string &logger_name);
378 const std::string &logging_folder,
379 bool format_messages,
bool use_os_log =
false);
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4354
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:189
Registry(const Registry &)=delete
void set_ready() noexcept
Flag that the registry has been initialized.
Definition: registry.h:181
static const std::map< std::string, LogLevel > kLogLevels
Definition: registry.h:48
std::mutex mtx_
Definition: registry.h:199
std::map< std::string, Logger > loggers_
Definition: registry.h:200
static const std::map< std::string, LogTimestampPrecision > kLogTimestampPrecisions
Definition: registry.h:50
Registry & operator=(const Registry &)=delete
std::map< std::string, std::shared_ptr< Handler > > handlers_
Definition: registry.h:202
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:402
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:248
HARNESS_EXPORT LogLevel log_level_from_string(std::string name)
Converts string with log level description to LogLevel type.
Definition: registry.cc:340
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:255
HARNESS_EXPORT void register_handler(std::string name, std::shared_ptr< Handler > handler)
Register handler for all plugins.
Definition: registry.cc:453
HARNESS_EXPORT std::string get_default_log_filename(const Config &config)
Get default log filename.
Definition: registry.cc:380
HARNESS_EXPORT void clear_registry(Registry ®istry)
Clear registry.
Definition: registry.cc:264
HARNESS_EXPORT LogLevel get_default_log_level(const Config &config, bool raw_mode=false)
Get default log level.
Definition: registry.cc:360
HARNESS_EXPORT void create_logger(Registry ®istry, const LogLevel level, const std::string &logger_name)
Definition: registry.cc:322
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:276
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:240
HARNESS_EXPORT void unregister_handler(std::string name)
Unregister a handler.
Definition: registry.cc:460
HARNESS_EXPORT LogTimestampPrecision get_default_timestamp_precision(const Config &config)
Get default timestamp precision.
Definition: registry.cc:423
HARNESS_EXPORT std::ostream * get_default_logger_stream()
Returns pointer to the default logger sink stream.
Definition: registry.cc:274
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:327
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:230
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