From b278baf94ef8f20065fa876c2fadd93c3c2ccedb Mon Sep 17 00:00:00 2001 From: gabime Date: Wed, 11 Dec 2019 00:42:00 +0200 Subject: [PATCH] wip --- include/spdlog/cfg/env-inl.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/spdlog/cfg/env-inl.h b/include/spdlog/cfg/env-inl.h index 98e0a343..7c23954e 100644 --- a/include/spdlog/cfg/env-inl.h +++ b/include/spdlog/cfg/env-inl.h @@ -58,8 +58,8 @@ inline name_val_pair extract_kv_(char sep, const std::string &str) return std::make_pair(trim_(k), trim_(v)); } -// return vector of key/value pairs from str. -// str format: "a=A,b=B,c=C,d=D,.." +// return vector of key/value pairs from sequence of "K1=V1,K2=V2,.." +// "a=AAA,b=BBB,c=CCC,.." => {("a","AAA"),("b","BBB"),("c", "CCC"),...} SPDLOG_INLINE std::unordered_map extract_key_vals_(const std::string &str) { std::string token; @@ -67,9 +67,13 @@ SPDLOG_INLINE std::unordered_map extract_key_vals_(con std::unordered_map rv; while (std::getline(token_stream, token, ',')) { + if(token.empty()) + { + continue; + } auto kv = extract_kv_('=', token); - // empty logger name or '*' marks all loggers + // '*' marks all loggers if (kv.first.empty()) { kv.first = "*";