mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
renamed loaders with cfg
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
|
||||
#pragma once
|
||||
#include <spdlog/loaders/helpers.h>
|
||||
#include <spdlog/cfg/helpers.h>
|
||||
#include <spdlog/details/os.h>
|
||||
|
||||
//
|
||||
@@ -18,7 +18,7 @@
|
||||
// example.exe "SPDLOG_LEVEL=off,logger1=debug,logger2=info"
|
||||
|
||||
namespace spdlog {
|
||||
namespace loaders {
|
||||
namespace cfg {
|
||||
|
||||
// search for SPDLOG_LEVEL= in the args and use it to init the levels
|
||||
void load_argv(int args, char **argv)
|
||||
@@ -36,5 +36,5 @@ void load_argv(int args, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace loaders
|
||||
} // namespace cfg
|
||||
} // namespace spdlog
|
@@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
|
||||
#pragma once
|
||||
#include <spdlog/loaders/helpers.h>
|
||||
#include <spdlog/cfg/helpers.h>
|
||||
#include <spdlog/details/registry.h>
|
||||
#include <spdlog/details/os.h>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// export SPDLOG_LEVEL="off,logger1=debug,logger2=info"
|
||||
|
||||
namespace spdlog {
|
||||
namespace loaders {
|
||||
namespace cfg {
|
||||
void load_env()
|
||||
{
|
||||
auto env_val = details::os::getenv("SPDLOG_LEVEL");
|
||||
@@ -32,5 +32,5 @@ void load_env()
|
||||
details::registry::instance().update_levels(std::move(levels));
|
||||
}
|
||||
|
||||
} // namespace loaders
|
||||
} // namespace cfg
|
||||
} // namespace spdlog
|
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef SPDLOG_HEADER_ONLY
|
||||
#include <spdlog/loaders/helpers.h>
|
||||
#include <spdlog/cfg/helpers.h>
|
||||
#endif
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <sstream>
|
||||
|
||||
namespace spdlog {
|
||||
namespace loaders {
|
||||
namespace cfg {
|
||||
namespace helpers {
|
||||
|
||||
// inplace convert to lowercase
|
||||
@@ -99,5 +99,5 @@ SPDLOG_INLINE log_levels extract_levels(const std::string &input)
|
||||
}
|
||||
|
||||
} // namespace helpers
|
||||
} // namespace loaders
|
||||
} // namespace cfg
|
||||
} // namespace spdlog
|
@@ -3,10 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/loaders/log_levels.h>
|
||||
#include <spdlog/cfg/log_levels.h>
|
||||
|
||||
namespace spdlog {
|
||||
namespace loaders {
|
||||
namespace cfg {
|
||||
namespace helpers {
|
||||
//
|
||||
// Init levels from given string
|
||||
@@ -20,7 +20,7 @@ namespace helpers {
|
||||
log_levels extract_levels(const std::string &txt);
|
||||
} // namespace helpers
|
||||
|
||||
} // namespace loaders
|
||||
} // namespace cfg
|
||||
} // namespace spdlog
|
||||
|
||||
#ifdef SPDLOG_HEADER_ONLY
|
@@ -8,7 +8,7 @@
|
||||
#include <unordered_map>
|
||||
|
||||
namespace spdlog {
|
||||
namespace loaders {
|
||||
namespace cfg {
|
||||
class log_levels
|
||||
{
|
||||
std::unordered_map<std::string, spdlog::level::level_enum> levels_;
|
||||
@@ -43,5 +43,5 @@ public:
|
||||
return default_level_;
|
||||
}
|
||||
};
|
||||
} // namespace loaders
|
||||
} // namespace cfg
|
||||
} // namespace spdlog
|
@@ -260,7 +260,7 @@ SPDLOG_INLINE void registry::set_automatic_registration(bool automatic_registrat
|
||||
automatic_registration_ = automatic_registration;
|
||||
}
|
||||
|
||||
SPDLOG_INLINE void registry::update_levels(loaders::log_levels levels)
|
||||
SPDLOG_INLINE void registry::update_levels(cfg::log_levels levels)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(logger_map_mutex_);
|
||||
levels_ = std::move(levels);
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// This class is thread safe
|
||||
|
||||
#include <spdlog/common.h>
|
||||
#include <spdlog/loaders/log_levels.h>
|
||||
#include <spdlog/cfg/log_levels.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
void set_automatic_registration(bool automatic_registration);
|
||||
|
||||
void update_levels(loaders::log_levels levels);
|
||||
void update_levels(cfg::log_levels levels);
|
||||
|
||||
static registry &instance();
|
||||
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
std::mutex logger_map_mutex_, flusher_mutex_;
|
||||
std::recursive_mutex tp_mutex_;
|
||||
std::unordered_map<std::string, std::shared_ptr<logger>> loggers_;
|
||||
loaders::log_levels levels_;
|
||||
cfg::log_levels levels_;
|
||||
std::unique_ptr<formatter> formatter_;
|
||||
level::level_enum flush_level_ = level::off;
|
||||
void (*err_handler_)(const std::string &msg);
|
||||
|
Reference in New Issue
Block a user