Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 10:29:01

0001 // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
0002 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
0003 
0004 #pragma once
0005 //
0006 // base sink templated over a mutex (either dummy or real)
0007 // concrete implementation should override the sink_it_() and flush_()  methods.
0008 // locking is taken care of in this class - no locking needed by the
0009 // implementers..
0010 //
0011 
0012 #include <spdlog/common.h>
0013 #include <spdlog/details/log_msg.h>
0014 #include <spdlog/sinks/sink.h>
0015 
0016 namespace spdlog {
0017 namespace sinks {
0018 template <typename Mutex>
0019 class SPDLOG_API base_sink : public sink {
0020 public:
0021     base_sink();
0022     explicit base_sink(std::unique_ptr<spdlog::formatter> formatter);
0023     ~base_sink() override = default;
0024 
0025     base_sink(const base_sink &) = delete;
0026     base_sink(base_sink &&) = delete;
0027 
0028     base_sink &operator=(const base_sink &) = delete;
0029     base_sink &operator=(base_sink &&) = delete;
0030 
0031     void log(const details::log_msg &msg) final;
0032     void flush() final;
0033     void set_pattern(const std::string &pattern) final;
0034     void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) final;
0035 
0036 protected:
0037     // sink formatter
0038     std::unique_ptr<spdlog::formatter> formatter_;
0039     Mutex mutex_;
0040 
0041     virtual void sink_it_(const details::log_msg &msg) = 0;
0042     virtual void flush_() = 0;
0043     virtual void set_pattern_(const std::string &pattern);
0044     virtual void set_formatter_(std::unique_ptr<spdlog::formatter> sink_formatter);
0045 };
0046 }  // namespace sinks
0047 }  // namespace spdlog
0048 
0049 #ifdef SPDLOG_HEADER_ONLY
0050     #include "base_sink-inl.h"
0051 #endif