clang-format

This commit is contained in:
gabime 2019-12-11 00:13:53 +02:00
parent da2c15ecb4
commit 4119b72d50

View File

@ -15,7 +15,6 @@
#include <utility> #include <utility>
#include <sstream> #include <sstream>
namespace spdlog { namespace spdlog {
namespace cfg { namespace cfg {
// inplace convert to lowercase // inplace convert to lowercase
@ -71,7 +70,7 @@ SPDLOG_INLINE std::unordered_map<std::string, std::string> extract_key_vals_(con
auto kv = extract_kv_('=', token); auto kv = extract_kv_('=', token);
// empty logger name or '*' marks all loggers // empty logger name or '*' marks all loggers
if(kv.first.empty()) if (kv.first.empty())
{ {
kv.first = "*"; kv.first = "*";
} }
@ -91,20 +90,20 @@ SPDLOG_INLINE cfg_map from_env()
// merge to single dict. and take into account "*" // merge to single dict. and take into account "*"
std::string default_level_name = "info"; std::string default_level_name = "info";
std::string default_pattern = "%+"; std::string default_pattern = "%+";
for(auto &name_level: levels) for (auto &name_level : levels)
{ {
auto &logger_name = name_level.first; auto &logger_name = name_level.first;
auto level_name = to_lower_(name_level.second); auto level_name = to_lower_(name_level.second);
logger_cfg cfg; logger_cfg cfg;
cfg.level_name = level_name; cfg.level_name = level_name;
configs[logger_name] = cfg; configs[logger_name] = cfg;
if(logger_name == "*") if (logger_name == "*")
{ {
default_level_name = cfg.level_name; default_level_name = cfg.level_name;
} }
} }
for(auto &name_pattern: patterns) for (auto &name_pattern : patterns)
{ {
auto &logger_name = name_pattern.first; auto &logger_name = name_pattern.first;
auto &pattern = name_pattern.second; auto &pattern = name_pattern.second;
@ -120,21 +119,21 @@ SPDLOG_INLINE cfg_map from_env()
cfg.pattern = pattern; cfg.pattern = pattern;
configs.insert({logger_name, cfg}); configs.insert({logger_name, cfg});
} }
if(logger_name == "*") if (logger_name == "*")
{ {
default_pattern = pattern; default_pattern = pattern;
} }
} }
//fill missing fields with the default values // fill missing fields with the default values
for(auto &cfg:configs) for (auto &cfg : configs)
{ {
auto &val = cfg.second; auto &val = cfg.second;
if(val.pattern.empty()) if (val.pattern.empty())
{ {
val.pattern = default_pattern; val.pattern = default_pattern;
} }
if(val.level_name.empty()) if (val.level_name.empty())
{ {
val.level_name = default_level_name; val.level_name = default_level_name;
} }