mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-26 23:49:03 +08:00
wip
This commit is contained in:
parent
f18e1fccfd
commit
cd5ddca00d
@ -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;
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -6,4 +6,3 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "spdlog/cfg/helpers-inl.h"
|
#include "spdlog/cfg/helpers-inl.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user