mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
removed force_flush from simple logger
This commit is contained in:
parent
4a90950fe5
commit
bd759bfca7
@ -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>;
|
||||||
|
Loading…
Reference in New Issue
Block a user