mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-27 03:00:46 +08:00
wip
This commit is contained in:
parent
49f707ec93
commit
5d4e6f17ee
@ -269,28 +269,11 @@ SPDLOG_INLINE void registry::set_configs(logger_cfgs configs)
|
|||||||
auto cfg_it = configs.loggers.find(logger->name());
|
auto cfg_it = configs.loggers.find(logger->name());
|
||||||
|
|
||||||
// use default config if not found for this logger name
|
// use default config if not found for this logger name
|
||||||
|
logger_cfg *cfg = cfg_it != configs.loggers.end() ? &cfg_it->second : &configs.default_cfg;
|
||||||
logger_cfg *cfg;
|
auto &level_name = cfg->level_name.empty() ? cfg->level_name: configs.default_cfg.level_name;
|
||||||
if(cfg_it != configs.loggers.end())
|
auto &pattern = cfg->pattern.empty() ? cfg->pattern: configs.default_cfg.pattern;
|
||||||
{
|
logger->set_level(level::from_str(level_name));
|
||||||
cfg = &cfg_it->second;
|
logger->set_formatter(details::make_unique<pattern_formatter>(pattern));
|
||||||
if(cfg->level_name.empty())
|
|
||||||
{
|
|
||||||
cfg->level_name = configs.default_cfg.level_name;
|
|
||||||
}
|
|
||||||
if(cfg->level_name.empty())
|
|
||||||
{
|
|
||||||
cfg->level_name = configs.default_cfg.level_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cfg = &configs.default_cfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
logger->set_level(level::from_str(cfg->level_name));
|
|
||||||
logger->set_formatter(details::make_unique<pattern_formatter>(cfg->pattern));
|
|
||||||
}
|
}
|
||||||
logger_cfgs_ = std::move(configs);
|
logger_cfgs_ = std::move(configs);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user