mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-01 10:59:02 +08:00
Removed close() from sink to have RAII semantics
This commit is contained in:
@@ -57,8 +57,6 @@ public:
|
||||
//Wait to remaining items (if any) in the queue to be written and shutdown
|
||||
void shutdown(const std::chrono::milliseconds& timeout);
|
||||
|
||||
void close() override;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
@@ -150,10 +148,6 @@ inline void spdlog::sinks::async_sink::shutdown(const std::chrono::milliseconds&
|
||||
_shutdown();
|
||||
}
|
||||
|
||||
inline void spdlog::sinks::async_sink::close()
|
||||
{
|
||||
_shutdown();
|
||||
}
|
||||
|
||||
|
||||
inline void spdlog::sinks::async_sink::_shutdown()
|
||||
@@ -166,7 +160,5 @@ inline void spdlog::sinks::async_sink::_shutdown()
|
||||
_back_thread.join();
|
||||
}
|
||||
|
||||
for (auto &s : _sinks)
|
||||
s->close();
|
||||
}
|
||||
|
||||
|
@@ -50,10 +50,7 @@ public:
|
||||
{
|
||||
_file_helper.open(filename);
|
||||
}
|
||||
void close() override
|
||||
{
|
||||
_file_helper.close();
|
||||
}
|
||||
|
||||
protected:
|
||||
void _sink_it(const details::log_msg& msg) override
|
||||
{
|
||||
@@ -86,10 +83,6 @@ public:
|
||||
_file_helper.open(calc_filename(_base_filename, 0, _extension));
|
||||
}
|
||||
|
||||
void close() override
|
||||
{
|
||||
_file_helper.close();
|
||||
}
|
||||
|
||||
protected:
|
||||
void _sink_it(const details::log_msg& msg) override
|
||||
@@ -171,10 +164,6 @@ public:
|
||||
_file_helper.open(calc_filename(_base_filename, _extension));
|
||||
}
|
||||
|
||||
void close() override
|
||||
{
|
||||
_file_helper.close();
|
||||
}
|
||||
|
||||
protected:
|
||||
void _sink_it(const details::log_msg& msg) override
|
||||
|
@@ -34,16 +34,13 @@ namespace sinks
|
||||
{
|
||||
|
||||
template <class Mutex>
|
||||
class null_sink : public base_sink<Mutex>
|
||||
class null_sink : public base_sink < Mutex >
|
||||
{
|
||||
protected:
|
||||
void _sink_it(const details::log_msg&) override
|
||||
{}
|
||||
|
||||
void close() override
|
||||
{}
|
||||
};
|
||||
|
||||
typedef null_sink<details::null_mutex> null_sink_st;
|
||||
typedef null_sink<std::mutex> null_sink_mt;
|
||||
|
||||
|
@@ -44,10 +44,6 @@ public:
|
||||
ostream_sink& operator=(const ostream_sink&) = delete;
|
||||
virtual ~ostream_sink() = default;
|
||||
|
||||
|
||||
void close() override
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void _sink_it(const details::log_msg& msg) override
|
||||
{
|
||||
|
@@ -35,7 +35,6 @@ class sink
|
||||
public:
|
||||
virtual ~sink() {}
|
||||
virtual void log(const details::log_msg& msg) = 0;
|
||||
virtual void close() = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user