Added mutexes to protect logger initialization and toggling automatic registration

This commit is contained in:
Pablo Arias 2018-11-10 16:55:35 +01:00
parent fbc58ebef8
commit 10895796b2

View File

@ -49,6 +49,7 @@ public:
void initialize_logger(std::shared_ptr<logger> new_logger) void initialize_logger(std::shared_ptr<logger> new_logger)
{ {
std::lock_guard<std::mutex> lock(logger_map_mutex_);
new_logger->set_formatter(formatter_->clone()); new_logger->set_formatter(formatter_->clone());
if (err_handler_) if (err_handler_)
@ -222,6 +223,7 @@ public:
void set_automatic_registration(bool automatic_regsistration) void set_automatic_registration(bool automatic_regsistration)
{ {
std::lock_guard<std::mutex> lock(logger_map_mutex_);
automatic_registration_ = automatic_regsistration; automatic_registration_ = automatic_regsistration;
} }