#include <registry.h>
◆ Registry() [1/2]
mysql_harness::logging::Registry::Registry |
( |
| ) |
|
|
default |
◆ Registry() [2/2]
mysql_harness::logging::Registry::Registry |
( |
const Registry & |
| ) |
|
|
delete |
◆ ~Registry()
mysql_harness::logging::Registry::~Registry |
( |
| ) |
|
|
default |
◆ add_handler()
void mysql_harness::logging::Registry::add_handler |
( |
std::string |
name, |
|
|
std::shared_ptr< Handler > |
handler |
|
) |
| |
Add a handler to the internal registry.
- Parameters
-
name | Handler id |
handler | Shared pointer to handler |
- Exceptions
-
std::logic_error | if there is a handler already registered with given module name |
◆ create_logger()
Create a logger in the internal registry.
- Parameters
-
name | Logger id (log domain it services) |
level | Log level for logger |
- Exceptions
-
std::logic_error | if there is a logger already registered with given module name |
◆ flush_all_loggers()
void mysql_harness::logging::Registry::flush_all_loggers |
( |
const std::string |
dst = "" | ) |
|
Force the flush (reopen) on all registered logger handlers, while moving old logger file to dst.
- Parameters
-
dst | destination filename for old log |
◆ get_handler()
std::shared_ptr< Handler > mysql_harness::logging::Registry::get_handler |
( |
const std::string & |
name | ) |
const |
Return handler in the internal registry.
- Parameters
-
- Exceptions
-
std::logic_error | if no handler is registered for given name |
◆ get_handler_names()
std::set< std::string > mysql_harness::logging::Registry::get_handler_names |
( |
| ) |
const |
Get the handler names from the internal registry.
◆ get_logger()
Logger mysql_harness::logging::Registry::get_logger |
( |
const std::string & |
name | ) |
const |
Return logger for particular module.
The reason why this function returns by value is thread-safety.
- Parameters
-
name | Logger id (log domain it services) |
- Exceptions
-
std::logic_error | if no logger is registered for given module name |
◆ get_logger_names()
std::set< std::string > mysql_harness::logging::Registry::get_logger_names |
( |
| ) |
const |
Get the logger names (id's) from the internal registry.
◆ get_logger_or_default()
Logger mysql_harness::logging::Registry::get_logger_or_default |
( |
const std::string & |
name, |
|
|
const std::string & |
default_name |
|
) |
| const |
Return logger for particular module.
if it doesn't exist, get the default logger.
- Parameters
-
name | Logger id (log domain it services) |
default_name | name of the default logger |
- Exceptions
-
std::logic_error | if neither logger is registered for given module name |
◆ is_handled()
bool mysql_harness::logging::Registry::is_handled |
( |
LogLevel |
level | ) |
const |
Check if a log-level is handled by at least one handler.
- Returns
- if at least one handler handles the log-level
- Return values
-
true | at least one handler |
false | log-level will be ignored. |
◆ is_ready()
bool mysql_harness::logging::Registry::is_ready |
( |
| ) |
const |
|
inlinenoexcept |
Query if logging facility is ready to use.
The exact meaning of this flag is not defined here, see description in set_ready()
◆ operator=()
◆ remove_handler()
void mysql_harness::logging::Registry::remove_handler |
( |
std::string |
name | ) |
|
Remove handler from the internal registry.
- Parameters
-
- Exceptions
-
std::logic_error | if no handler is registered for given name |
◆ remove_logger()
void mysql_harness::logging::Registry::remove_logger |
( |
const std::string & |
name | ) |
|
Remove a named logger from the internal registry.
- Parameters
-
name | Logger id (log domain it services) |
- Exceptions
-
std::logic_error | if there is no logger registered with given module name |
◆ set_ready()
void mysql_harness::logging::Registry::set_ready |
( |
| ) |
|
|
inlinenoexcept |
Flag that the registry has been initialized.
This method should be called after log initialization is complete to flag that logging facility is now available. Note that this is a convenience flag - it does not directly affect the operation of Registry. However, a logging function (i.e. log_message()) might want to query this flag when called and do whatever it deems appropriate.
◆ update_logger()
void mysql_harness::logging::Registry::update_logger |
( |
const std::string & |
name, |
|
|
const Logger & |
logger |
|
) |
| |
Update logger for particular module.
This function provides a thread-safe way of updating the Logger object in the registry.
- Parameters
-
name | Logger id (log domain it services) |
logger | Logger object |
- Exceptions
-
std::logic_error | if no logger is registered for given module name |
◆ handlers_
std::map<std::string, std::shared_ptr<Handler> > mysql_harness::logging::Registry::handlers_ |
|
private |
◆ loggers_
std::map<std::string, Logger> mysql_harness::logging::Registry::loggers_ |
|
private |
◆ mtx_
std::mutex mysql_harness::logging::Registry::mtx_ |
|
mutableprivate |
◆ ready_
std::atomic<bool> mysql_harness::logging::Registry::ready_ {false} |
|
private |
The documentation for this class was generated from the following files: