Commit 3556c87a authored by gabime's avatar gabime

Fixed issue #61 (spdlog::set_level(...) does not affect loggers created afterwords)

parent e9dbd4c0
...@@ -41,7 +41,6 @@ namespace spdlog ...@@ -41,7 +41,6 @@ namespace spdlog
{ {
namespace details namespace details
{ {
class registry class registry
{ {
public: public:
...@@ -94,7 +93,6 @@ public: ...@@ -94,7 +93,6 @@ public:
return create(logger_name, { sink }); return create(logger_name, { sink });
} }
void formatter(formatter_ptr f) void formatter(formatter_ptr f)
{ {
std::lock_guard<std::mutex> lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
...@@ -103,14 +101,12 @@ public: ...@@ -103,14 +101,12 @@ public:
l.second->set_formatter(_formatter); l.second->set_formatter(_formatter);
} }
void set_pattern(const std::string& pattern) void set_pattern(const std::string& pattern)
{ {
std::lock_guard<std::mutex> lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
_formatter = std::make_shared<pattern_formatter>(pattern); _formatter = std::make_shared<pattern_formatter>(pattern);
for (auto& l : _loggers) for (auto& l : _loggers)
l.second->set_formatter(_formatter); l.second->set_formatter(_formatter);
} }
void set_level(level::level_enum log_level) void set_level(level::level_enum log_level)
...@@ -118,6 +114,7 @@ public: ...@@ -118,6 +114,7 @@ public:
std::lock_guard<std::mutex> lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
for (auto& l : _loggers) for (auto& l : _loggers)
l.second->set_level(log_level); l.second->set_level(log_level);
_level = log_level;
} }
void set_async_mode(size_t q_size, const async_overflow_policy overflow_policy, const std::function<void()>& worker_warmup_cb) void set_async_mode(size_t q_size, const async_overflow_policy overflow_policy, const std::function<void()>& worker_warmup_cb)
...@@ -135,7 +132,6 @@ public: ...@@ -135,7 +132,6 @@ public:
_async_mode = false; _async_mode = false;
} }
static registry& instance() static registry& instance()
{ {
static registry s_instance; static registry s_instance;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment