This commit is contained in:
gabime 2019-12-21 17:55:30 +02:00
parent f18e1fccfd
commit cd5ddca00d
4 changed files with 6 additions and 10 deletions

View File

@ -19,7 +19,6 @@ namespace spdlog {
namespace cfg { namespace cfg {
namespace helpers { namespace helpers {
using name_val_pair = std::pair<std::string, std::string>;
// inplace convert to lowercase // inplace convert to lowercase
inline std::string &to_lower_(std::string &str) inline std::string &to_lower_(std::string &str)
@ -44,7 +43,8 @@ inline std::string &trim_(std::string &str)
// " key = val " => ("key", "val") // " key = val " => ("key", "val")
// "key=" => ("key", "") // "key=" => ("key", "")
// "val" => ("", "val") // "val" => ("", "val")
inline name_val_pair extract_kv_(char sep, const std::string &str)
inline std::pair<std::string, std::string> extract_kv_(char sep, const std::string &str)
{ {
auto n = str.find(sep); auto n = str.find(sep);
std::string k, v; std::string k, v;

View File

@ -4,9 +4,7 @@
#pragma once #pragma once
#include <spdlog/cfg/log_levels.h> #include <spdlog/cfg/log_levels.h>
#include <spdlog/common.h>
#include <string> #include <string>
#include <unordered_map>
// //
// Init levels from given string // Init levels from given string

View File

@ -11,10 +11,11 @@ namespace spdlog {
namespace cfg { namespace cfg {
class log_levels class log_levels
{ {
using levels_map = std::unordered_map<std::string, spdlog::level::level_enum>;
levels_map levels_;
spdlog::level::level_enum default_level_ = level::info;
public: public:
using levels_map = std::unordered_map<std::string, spdlog::level::level_enum>;
void set(const std::string &logger_name, level::level_enum lvl) void set(const std::string &logger_name, level::level_enum lvl)
{ {
if (logger_name.empty()) if (logger_name.empty())
@ -38,9 +39,7 @@ public:
return default_level_; return default_level_;
} }
private:
levels_map levels_;
spdlog::level::level_enum default_level_ = level::info;
}; };
} // namespace cfg } // namespace cfg
} // namespace spdlog } // namespace spdlog

View File

@ -6,4 +6,3 @@
#endif #endif
#include "spdlog/cfg/helpers-inl.h" #include "spdlog/cfg/helpers-inl.h"