Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
spdlog::sinks::dist_sink< Mutex > Class Template Reference

#include <dist_sink.h>

Inheritance diagram for spdlog::sinks::dist_sink< Mutex >:
spdlog::sinks::base_sink< Mutex > spdlog::sinks::sink

Public Member Functions

 dist_sink ()=default
 
 dist_sink (const dist_sink &)=delete
 
dist_sinkoperator= (const dist_sink &)=delete
 
void add_sink (std::shared_ptr< sink > sink)
 
void remove_sink (std::shared_ptr< sink > sink)
 
void set_sinks (std::vector< std::shared_ptr< sink >> sinks)
 
- Public Member Functions inherited from spdlog::sinks::base_sink< Mutex >
 base_sink ()=default
 
 base_sink (const base_sink &)=delete
 
base_sinkoperator= (const base_sink &)=delete
 
void log (const details::log_msg &msg) final
 
void flush () final
 
void set_pattern (const std::string &pattern) final
 
void set_formatter (std::unique_ptr< spdlog::formatter > sink_formatter) final
 
- Public Member Functions inherited from spdlog::sinks::sink
 sink ()
 
 sink (std::unique_ptr< spdlog::pattern_formatter > formatter)
 
virtual ~sink ()=default
 
bool should_log (level::level_enum msg_level) const
 
void set_level (level::level_enum log_level)
 
level::level_enum level () const
 

Protected Member Functions

void sink_it_ (const details::log_msg &msg) override
 
void flush_ () override
 
void set_pattern_ (const std::string &pattern) override
 
void set_formatter_ (std::unique_ptr< spdlog::formatter > sink_formatter) override
 

Protected Attributes

std::vector< std::shared_ptr< sink > > sinks_
 
- Protected Attributes inherited from spdlog::sinks::base_sink< Mutex >
Mutex mutex_
 
- Protected Attributes inherited from spdlog::sinks::sink
level_t level_
 
std::unique_ptr< spdlog::formatterformatter_
 

Detailed Description

template<typename Mutex>
class spdlog::sinks::dist_sink< Mutex >

Definition at line 28 of file dist_sink.h.

Constructor & Destructor Documentation

template<typename Mutex >
spdlog::sinks::dist_sink< Mutex >::dist_sink ( )
default
template<typename Mutex >
spdlog::sinks::dist_sink< Mutex >::dist_sink ( const dist_sink< Mutex > &  )
delete

Member Function Documentation

template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::add_sink ( std::shared_ptr< sink sink)
inline

Definition at line 35 of file dist_sink.h.

36  {
37  std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
38  sinks_.push_back(sink);
39  }
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::flush_ ( )
inlineoverrideprotectedvirtual

Implements spdlog::sinks::base_sink< Mutex >.

Definition at line 66 of file dist_sink.h.

67  {
68  for (auto &sink : sinks_)
69  {
70  sink->flush();
71  }
72  }
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87
template<typename Mutex >
dist_sink& spdlog::sinks::dist_sink< Mutex >::operator= ( const dist_sink< Mutex > &  )
delete
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::remove_sink ( std::shared_ptr< sink sink)
inline

Definition at line 41 of file dist_sink.h.

42  {
43  std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
44  sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end());
45  }
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::set_formatter_ ( std::unique_ptr< spdlog::formatter sink_formatter)
inlineoverrideprotectedvirtual

Reimplemented from spdlog::sinks::base_sink< Mutex >.

Definition at line 79 of file dist_sink.h.

80  {
81  base_sink<Mutex>::formatter_ = std::move(sink_formatter);
82  for (auto &sink : sinks_)
83  {
84  sink->set_formatter(base_sink<Mutex>::formatter_->clone());
85  }
86  }
std::unique_ptr< spdlog::formatter > formatter_
Definition: sink.h:55
def move(depos, offset)
Definition: depos.py:107
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::set_pattern_ ( const std::string pattern)
inlineoverrideprotectedvirtual

Reimplemented from spdlog::sinks::base_sink< Mutex >.

Definition at line 74 of file dist_sink.h.

75  {
76  set_formatter_(details::make_unique<spdlog::pattern_formatter>(pattern));
77  }
void set_formatter_(std::unique_ptr< spdlog::formatter > sink_formatter) override
Definition: dist_sink.h:79
std::string pattern
Definition: regex_t.cc:33
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::set_sinks ( std::vector< std::shared_ptr< sink >>  sinks)
inline

Definition at line 47 of file dist_sink.h.

48  {
49  std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
50  sinks_ = std::move(sinks);
51  }
def move(depos, offset)
Definition: depos.py:107
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87
template<typename Mutex >
void spdlog::sinks::dist_sink< Mutex >::sink_it_ ( const details::log_msg msg)
inlineoverrideprotectedvirtual

Implements spdlog::sinks::base_sink< Mutex >.

Definition at line 54 of file dist_sink.h.

55  {
56 
57  for (auto &sink : sinks_)
58  {
59  if (sink->should_log(msg.level))
60  {
61  sink->log(msg);
62  }
63  }
64  }
void msg(const char *fmt,...)
Definition: message.cpp:107
std::vector< std::shared_ptr< sink > > sinks_
Definition: dist_sink.h:87

Member Data Documentation

template<typename Mutex >
std::vector<std::shared_ptr<sink> > spdlog::sinks::dist_sink< Mutex >::sinks_
protected

Definition at line 87 of file dist_sink.h.


The documentation for this class was generated from the following file: