mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 09:59:33 +08:00
Added mutexes to protect logger initialization and toggling automatic registration
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user