removed force_flush from simple logger

This commit is contained in:
gabime 2018-07-05 16:34:20 +03:00
parent 4a90950fe5
commit bd759bfca7

View File

@ -22,24 +22,16 @@ class simple_file_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
public: public:
explicit simple_file_sink(const filename_t &filename, bool truncate = false) explicit simple_file_sink(const filename_t &filename, bool truncate = false)
: force_flush_(false)
{ {
file_helper_.open(filename, truncate); file_helper_.open(filename, truncate);
} }
void set_force_flush(bool force_flush)
{
force_flush_ = force_flush;
}
protected: protected:
void sink_it_(const details::log_msg &, const fmt::memory_buffer &formatted) override void sink_it_(const details::log_msg &, const fmt::memory_buffer &formatted) override
{ {
file_helper_.write(formatted); file_helper_.write(formatted);
if (force_flush_)
{
file_helper_.flush();
}
} }
void flush_() override void flush_() override
@ -49,7 +41,6 @@ protected:
private: private:
details::file_helper file_helper_; details::file_helper file_helper_;
bool force_flush_;
}; };
using simple_file_sink_mt = simple_file_sink<std::mutex>; using simple_file_sink_mt = simple_file_sink<std::mutex>;