Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 08:53:00

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/details/synchronous_factory.h>
0008 #include <spdlog/sinks/base_sink.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 protected:
0018     void sink_it_(const details::log_msg &) override {}
0019     void flush_() override {}
0020 };
0021 
0022 using null_sink_mt = null_sink<details::null_mutex>;
0023 using null_sink_st = null_sink<details::null_mutex>;
0024 
0025 }  // namespace sinks
0026 
0027 template <typename Factory = spdlog::synchronous_factory>
0028 inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name) {
0029     auto null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
0030     null_logger->set_level(level::off);
0031     return null_logger;
0032 }
0033 
0034 template <typename Factory = spdlog::synchronous_factory>
0035 inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name) {
0036     auto null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
0037     null_logger->set_level(level::off);
0038     return null_logger;
0039 }
0040 
0041 }  // namespace spdlog