Sha256: 3c2904eb361eae8af2d0fa9d42489332c538ccadf5b2841cfd37fda582605d32

Contents?: true

Size: 1.51 KB

Versions: 34

Compression:

Stored size: 1.51 KB

Contents

// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once
//
// base sink templated over a mutex (either dummy or real)
// concrete implementation should override the sink_it_() and flush_()  methods.
// locking is taken care of in this class - no locking needed by the
// implementers..
//

#include <spdlog/common.h>
#include <spdlog/details/log_msg.h>
#include <spdlog/sinks/sink.h>

namespace spdlog {
namespace sinks {
template<typename Mutex>
class base_sink : public sink
{
public:
    base_sink();
    explicit base_sink(std::unique_ptr<spdlog::formatter> formatter);
    ~base_sink() override = default;

    base_sink(const base_sink &) = delete;
    base_sink(base_sink &&) = delete;

    base_sink &operator=(const base_sink &) = delete;
    base_sink &operator=(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;

protected:
    // sink formatter
    std::unique_ptr<spdlog::formatter> formatter_;
    Mutex mutex_;

    virtual void sink_it_(const details::log_msg &msg) = 0;
    virtual void flush_() = 0;
    virtual void set_pattern_(const std::string &pattern);
    virtual void set_formatter_(std::unique_ptr<spdlog::formatter> sink_formatter);
};
} // namespace sinks
} // namespace spdlog

#ifdef SPDLOG_HEADER_ONLY
#include "base_sink-inl.h"
#endif

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
couchbase-3.2.0-universal-darwin-20 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.2.0 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.1.1 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.1.1-universal-darwin-20 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.1.0 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.3 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.3-universal-darwin-20 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.2 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.1-universal-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.1 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0-universal-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.beta.1 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.5 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/spdlog/include/spdlog/sinks/base_sink.h
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/sinks/base_sink.h