diff --git a/example/example.cpp b/example/example.cpp index 9ff70b10..a9fca546 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -25,7 +25,7 @@ void syslog_example(); int main(int args, char *argv[]) { - //spdlog::cfg::init_from_env(); + // spdlog::cfg::init_from_env(); spdlog::cfg::init_from_argv(args, argv); spdlog::info("HELLO INFO"); diff --git a/include/spdlog/cfg/argv_loader.h b/include/spdlog/cfg/argv_loader.h index 4a9ed1de..45872673 100644 --- a/include/spdlog/cfg/argv_loader.h +++ b/include/spdlog/cfg/argv_loader.h @@ -9,7 +9,6 @@ // Init levels from argv SPDLOG_LEVEL // Example: my_program.exe "SPDLOG_LEVEL=trace" - namespace spdlog { namespace cfg { // search for SPDLOG_LEVEL= in the args and use it to init the levels diff --git a/include/spdlog/cfg/cfg.h b/include/spdlog/cfg/cfg.h index 9f9d3c5b..d7a90445 100644 --- a/include/spdlog/cfg/cfg.h +++ b/include/spdlog/cfg/cfg.h @@ -8,42 +8,39 @@ #include namespace spdlog { - namespace cfg { - class log_levels +namespace cfg { +class log_levels +{ + +public: + using levels_map = std::unordered_map; + + void set(const std::string &logger_name, level::level_enum lvl) + { + if (logger_name.empty()) { + default_level_ = lvl; + } + else + { + levels_[logger_name] = lvl; + } + } - public: - using levels_map = std::unordered_map; + level::level_enum get(const std::string &logger_name) + { + auto it = levels_.find(logger_name); + return it != levels_.end() ? it->second : default_level_; + } - void set(const std::string& logger_name, level::level_enum lvl) - { - if (logger_name.empty()) - { - default_level_ = lvl; - } - else - { - levels_[logger_name] = lvl; - } - } + level::level_enum get() + { + return default_level_; + } - level::level_enum get(const std::string &logger_name) - { - auto it = levels_.find(logger_name); - return it != levels_.end() ? it->second : default_level_; - } - - level::level_enum get() - { - return default_level_; - } - - private: - std::unordered_map levels_; - spdlog::level::level_enum default_level_ = level::info; - - }; - } // namespace cfg +private: + std::unordered_map levels_; + spdlog::level::level_enum default_level_ = level::info; +}; +} // namespace cfg } // namespace spdlog - - diff --git a/include/spdlog/cfg/text_loader-inl.h b/include/spdlog/cfg/text_loader-inl.h index 5ceb3fc5..d1a52bfa 100644 --- a/include/spdlog/cfg/text_loader-inl.h +++ b/include/spdlog/cfg/text_loader-inl.h @@ -95,7 +95,6 @@ inline log_levels extract_levels_(const std::string &input) level = level::info; } rv.set(logger_name, level); - } return rv; } diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index 2697f070..21827279 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -30,7 +30,6 @@ namespace spdlog { namespace details { - SPDLOG_INLINE registry::registry() : formatter_(new pattern_formatter()) { diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 1f7dcde8..612a2412 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -28,7 +28,6 @@ class periodic_worker; class registry { public: - registry(const registry &) = delete; registry &operator=(const registry &) = delete;