From 3403f27898cc8b50b7ab3b7fcc9057a657d7c574 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 26 Apr 2024 01:32:10 +0300 Subject: [PATCH] Don't remove previous defaullt logger from registry in set_default_logger. Fix #3016 --- include/spdlog/details/registry-inl.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index c55b0931..d03934d9 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -123,11 +123,7 @@ SPDLOG_INLINE logger *registry::get_default_raw() { return default_logger_.get() // set default logger. // default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map. SPDLOG_INLINE void registry::set_default_logger(std::shared_ptr new_default_logger) { - std::lock_guard lock(logger_map_mutex_); - // remove previous default logger from the map - if (default_logger_ != nullptr) { - loggers_.erase(default_logger_->name()); - } + std::lock_guard lock(logger_map_mutex_); if (new_default_logger != nullptr) { loggers_[new_default_logger->name()] = new_default_logger; }