Don't remove previous defaullt logger from registry in set_default_logger. Fix #3016

This commit is contained in:
gabime 2024-04-26 01:32:10 +03:00
parent a34e08c7ff
commit 3403f27898

View File

@ -124,10 +124,6 @@ SPDLOG_INLINE logger *registry::get_default_raw() { return default_logger_.get()
// 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<logger> new_default_logger) {
std::lock_guard<std::mutex> lock(logger_map_mutex_);
// remove previous default logger from the map
if (default_logger_ != nullptr) {
loggers_.erase(default_logger_->name());
}
if (new_default_logger != nullptr) {
loggers_[new_default_logger->name()] = new_default_logger;
}