wip
This commit is contained in:
		@@ -19,7 +19,6 @@ namespace spdlog {
 | 
			
		||||
namespace cfg {
 | 
			
		||||
namespace helpers {
 | 
			
		||||
 | 
			
		||||
using name_val_pair = std::pair<std::string, std::string>;
 | 
			
		||||
 | 
			
		||||
// inplace convert to lowercase
 | 
			
		||||
inline std::string &to_lower_(std::string &str)
 | 
			
		||||
@@ -44,7 +43,8 @@ inline std::string &trim_(std::string &str)
 | 
			
		||||
// " key  =  val " => ("key", "val")
 | 
			
		||||
// "key=" => ("key", "")
 | 
			
		||||
// "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);
 | 
			
		||||
    std::string k, v;
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <spdlog/cfg/log_levels.h>
 | 
			
		||||
#include <spdlog/common.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <unordered_map>
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Init levels from given string
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,11 @@ namespace spdlog {
 | 
			
		||||
namespace cfg {
 | 
			
		||||
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:
 | 
			
		||||
    using levels_map = std::unordered_map<std::string, spdlog::level::level_enum>;
 | 
			
		||||
 | 
			
		||||
    void set(const std::string &logger_name, level::level_enum lvl)
 | 
			
		||||
    {
 | 
			
		||||
        if (logger_name.empty())
 | 
			
		||||
@@ -38,9 +39,7 @@ public:
 | 
			
		||||
        return default_level_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    levels_map levels_;
 | 
			
		||||
    spdlog::level::level_enum default_level_ = level::info;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
} // namespace cfg
 | 
			
		||||
} // namespace spdlog
 | 
			
		||||
 
 | 
			
		||||
@@ -6,4 +6,3 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "spdlog/cfg/helpers-inl.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user