Don't remove existing logger from registry in set_default_logger

This commit is contained in:
gabime 2024-05-03 13:31:30 +03:00
parent f0b96d2ad1
commit d60a4c7b50

View File

@ -125,10 +125,6 @@ namespace spdlog {
// default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map.
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;
}