mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
Don't remove previous defaullt logger from registry in set_default_logger. Fix #3016
This commit is contained in:
parent
a34e08c7ff
commit
3403f27898
@ -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<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());
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(logger_map_mutex_);
|
||||
if (new_default_logger != nullptr) {
|
||||
loggers_[new_default_logger->name()] = new_default_logger;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user