Last change
on this file was
19170,
checked in by westram, 2 years ago
|
- sina source
- unpack + remove tarball
- no longer ignore sina builddir.
|
File size:
1.1 KB
|
Line | |
---|
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 | |
---|
12 | #include "spdlog/details/null_mutex.h" |
---|
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 | |
---|
28 | using null_sink_mt = null_sink<std::mutex>; |
---|
29 | using null_sink_st = null_sink<details::null_mutex>; |
---|
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 |
---|
Note: See
TracBrowser
for help on using the repository browser.