Agora  1.2.0
Agora project
null_sink.h
Go to the documentation of this file.
1 // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 
4 #pragma once
5 
9 
10 #include <mutex>
11 
12 namespace spdlog {
13 namespace sinks {
14 
15 template<typename Mutex>
16 class null_sink : public base_sink<Mutex>
17 {
18 protected:
19  void sink_it_(const details::log_msg &) override {}
20  void flush_() override {}
21 };
22 
25 
26 } // namespace sinks
27 
28 template<typename Factory = spdlog::synchronous_factory>
29 inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name)
30 {
31  auto null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
32  null_logger->set_level(level::off);
33  return null_logger;
34 }
35 
36 template<typename Factory = spdlog::synchronous_factory>
37 inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name)
38 {
39  auto null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
40  null_logger->set_level(level::off);
41  return null_logger;
42 }
43 
44 } // namespace spdlog
base_sink.h
spdlog::level::off
@ off
Definition: common.h:219
synchronous_factory.h
null_mutex.h
spdlog::null_logger_mt
std::shared_ptr< logger > null_logger_mt(const std::string &logger_name)
Definition: null_sink.h:29
spdlog
Definition: async.h:25
spdlog::sinks::base_sink
Definition: base_sink.h:19
spdlog::sinks::null_sink::flush_
void flush_() override
Definition: null_sink.h:20
spdlog::details::log_msg
Definition: log_msg.h:11
spdlog::sinks::null_sink
Definition: null_sink.h:16
spdlog::null_logger_st
std::shared_ptr< logger > null_logger_st(const std::string &logger_name)
Definition: null_sink.h:37
spdlog::sinks::null_sink::sink_it_
void sink_it_(const details::log_msg &) override
Definition: null_sink.h:19