Commit 45717147 authored by gabime's avatar gabime

Improved null_logger factory

parent f2f9f324
...@@ -33,13 +33,17 @@ using null_sink_st = null_sink<details::null_mutex>; ...@@ -33,13 +33,17 @@ using null_sink_st = null_sink<details::null_mutex>;
template<typename Factory = default_factory> template<typename Factory = default_factory>
inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name) inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name)
{ {
return Factory::template create<sinks::null_sink_mt>(logger_name); auto null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
null_logger->set_level(level::off);
return null_logger;
} }
template<typename Factory = default_factory> template<typename Factory = default_factory>
inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name) inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name)
{ {
return Factory::template create<sinks::null_sink_st>(logger_name); auto null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
null_logger->set_level(level::off);
return null_logger;
} }
} // namespace spdlog } // namespace spdlog
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