6 #ifndef SPDLOG_HEADER_ONLY
27 str.begin(), str.end(), str.begin(), [](
char ch) { return static_cast<char>((ch >=
'A' && ch <=
'Z') ? ch + (
'a' -
'A') : ch); });
32 inline std::string &
trim_(std::string &str)
34 const char *spaces =
" \n\r\t";
35 str.erase(str.find_last_not_of(spaces) + 1);
36 str.erase(0, str.find_first_not_of(spaces));
47 inline std::pair<std::string, std::string>
extract_kv_(
char sep,
const std::string &str)
49 auto n = str.find(sep);
51 if (
n == std::string::npos)
58 v = str.substr(
n + 1);
65 inline std::unordered_map<std::string, std::string>
extract_key_vals_(
const std::string &str)
68 std::istringstream token_stream(str);
69 std::unordered_map<std::string, std::string> rv{};
70 while (std::getline(token_stream, token,
','))
77 rv[kv.first] = kv.second;
84 if (input.empty() || input.size() > 512)
90 std::unordered_map<std::string, level::level_enum> levels;
92 bool global_level_found =
false;
94 for (
auto &name_level : key_vals)
96 auto &logger_name = name_level.first;
97 auto level_name =
to_lower_(name_level.second);
100 if (level ==
level::off && level_name !=
"off")
104 if (logger_name.empty())
106 global_level_found =
true;
107 global_level = level;
111 levels[logger_name] = level;