Skip to content

Commit

Permalink
Don't remove previous defaullt logger from registry in set_default_lo…
Browse files Browse the repository at this point in the history
…gger. Fix #3016
  • Loading branch information
gabime committed Apr 25, 2024
1 parent a34e08c commit 3403f27
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions include/spdlog/details/registry-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3403f27

Please sign in to comment.