Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:58:15

0001 // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
0002 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
0003 
0004 #pragma once
0005 
0006 #include <spdlog/details/null_mutex.h>
0007 #include <spdlog/sinks/base_sink.h>
0008 #include <spdlog/details/synchronous_factory.h>
0009 
0010 #include <mutex>
0011 
0012 namespace spdlog {
0013 namespace sinks {
0014 
0015 template<typename Mutex>
0016 class null_sink : public base_sink<Mutex>
0017 {
0018 protected:
0019     void sink_it_(const details::log_msg &) override {}
0020     void flush_() override {}
0021 };
0022 
0023 using null_sink_mt = null_sink<details::null_mutex>;
0024 using null_sink_st = null_sink<details::null_mutex>;
0025 
0026 } // namespace sinks
0027 
0028 template<typename Factory = spdlog::synchronous_factory>
0029 inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name)
0030 {
0031     auto null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
0032     null_logger->set_level(level::off);
0033     return null_logger;
0034 }
0035 
0036 template<typename Factory = spdlog::synchronous_factory>
0037 inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name)
0038 {
0039     auto null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
0040     null_logger->set_level(level::off);
0041     return null_logger;
0042 }
0043 
0044 } // namespace spdlog