mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
Refactored sink interface and base_sink
This commit is contained in:
@@ -5,14 +5,19 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class failing_sink : public spdlog::sinks::sink
|
||||
class failing_sink : public spdlog::sinks::base_sink<std::mutex>
|
||||
{
|
||||
void log(const spdlog::details::log_msg &) override
|
||||
public:
|
||||
failing_sink() = default;
|
||||
~failing_sink() = default;
|
||||
|
||||
protected:
|
||||
void sink_it_(const spdlog::details::log_msg &) override
|
||||
{
|
||||
throw std::runtime_error("some error happened during log");
|
||||
}
|
||||
|
||||
void flush() override
|
||||
void flush_() override
|
||||
{
|
||||
throw std::runtime_error("some error happened during flush");
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void sink_it_(const details::log_msg &, const fmt::memory_buffer &) override
|
||||
void sink_it_(const details::log_msg &) override
|
||||
{
|
||||
msg_counter_++;
|
||||
std::this_thread::sleep_for(delay_);
|
||||
|
Reference in New Issue
Block a user