Improved null_logger factory

This commit is contained in:
gabime 2018-10-13 20:01:05 +03:00
parent f2f9f324ec
commit 45717147f7

View File

@ -33,13 +33,17 @@ using null_sink_st = null_sink<details::null_mutex>;
template<typename Factory = default_factory>
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>
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