Use find if registry is bigger than 10 in registry::get(std::string_view logger_name)

This commit is contained in:
gabime 2024-03-17 00:30:05 +02:00
parent 4052bc0621
commit 819eb27c5d

View File

@ -99,7 +99,7 @@ std::shared_ptr<logger> registry::get(const std::string &logger_name) {
// otherwise use the standard find()
SPDLOG_INLINE std::shared_ptr<logger> registry::get(std::string_view logger_name) {
std::lock_guard<std::mutex> lock(logger_map_mutex_);
if (loggers_.size() <= 20) {
if (loggers_.size() <= 10) {
for (const auto &[key, val]: loggers_) {
if (logger_name == key) {
return val;