WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
null_sink.h
Go to the documentation of this file.
1 //
2 // Copyright(c) 2015 Gabi Melman.
3 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
4 //
5 
6 #pragma once
7 
8 #ifndef SPDLOG_H
9 #include "spdlog/spdlog.h"
10 #endif
11 
13 #include "spdlog/sinks/base_sink.h"
14 
15 #include <mutex>
16 
17 namespace spdlog {
18 namespace sinks {
19 
20 template<typename Mutex>
21 class null_sink : public base_sink<Mutex>
22 {
23 protected:
24  void sink_it_(const details::log_msg &) override {}
25  void flush_() override {}
26 };
27 
30 
31 } // namespace sinks
32 
33 template<typename Factory = default_factory>
34 inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name)
35 {
36  auto null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
37  null_logger->set_level(level::off);
38  return null_logger;
39 }
40 
41 template<typename Factory = default_factory>
42 inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name)
43 {
44  auto null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
45  null_logger->set_level(level::off);
46  return null_logger;
47 }
48 
49 } // namespace spdlog
std::shared_ptr< logger > null_logger_mt(const std::string &logger_name)
Definition: null_sink.h:34
Definition: async.h:27
void sink_it_(const details::log_msg &) override
Definition: null_sink.h:24
std::shared_ptr< logger > null_logger_st(const std::string &logger_name)
Definition: null_sink.h:42
void flush_() override
Definition: null_sink.h:25