Agora  1.2.0
Agora project
base_sink-inl.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 
6 #ifndef SPDLOG_HEADER_ONLY
7 # include <spdlog/sinks/base_sink.h>
8 #endif
9 
10 #include <spdlog/common.h>
12 
13 #include <memory>
14 
15 template<typename Mutex>
17  : formatter_{details::make_unique<spdlog::pattern_formatter>()}
18 {}
19 
20 template<typename Mutex>
22  : formatter_{std::move(formatter)}
23 {}
24 
25 template<typename Mutex>
27 {
28  std::lock_guard<Mutex> lock(mutex_);
29  sink_it_(msg);
30 }
31 
32 template<typename Mutex>
34 {
35  std::lock_guard<Mutex> lock(mutex_);
36  flush_();
37 }
38 
39 template<typename Mutex>
41 {
42  std::lock_guard<Mutex> lock(mutex_);
43  set_pattern_(pattern);
44 }
45 
46 template<typename Mutex>
47 void SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter)
48 {
49  std::lock_guard<Mutex> lock(mutex_);
50  set_formatter_(std::move(sink_formatter));
51 }
52 
53 template<typename Mutex>
55 {
56  set_formatter_(details::make_unique<spdlog::pattern_formatter>(pattern));
57 }
58 
59 template<typename Mutex>
60 void SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_formatter_(std::unique_ptr<spdlog::formatter> sink_formatter)
61 {
62  formatter_ = std::move(sink_formatter);
63 }
spdlog::formatter
Definition: formatter.h:11
spdlog::sinks::base_sink::flush
void flush() final
Definition: base_sink-inl.h:33
base_sink.h
spdlog::sinks::base_sink::log
void log(const details::log_msg &msg) final
Definition: base_sink-inl.h:26
spdlog::sinks::base_sink::set_formatter_
virtual void set_formatter_(std::unique_ptr< spdlog::formatter > sink_formatter)
Definition: base_sink-inl.h:60
SPDLOG_INLINE
#define SPDLOG_INLINE
Definition: common.h:42
spdlog::sinks::base_sink::set_pattern_
virtual void set_pattern_(const std::string &pattern)
Definition: base_sink-inl.h:54
spdlog::sinks::base_sink::set_formatter
void set_formatter(std::unique_ptr< spdlog::formatter > sink_formatter) final
Definition: base_sink-inl.h:47
spdlog::sinks::base_sink::base_sink
base_sink()
Definition: base_sink-inl.h:16
common.h
spdlog::details::log_msg
Definition: log_msg.h:11
pattern_formatter.h
spdlog::sinks::base_sink::set_pattern
void set_pattern(const std::string &pattern) final
Definition: base_sink-inl.h:40