From 96ff1337bdcdfebecbc4bcaed78f7712d067ba7b Mon Sep 17 00:00:00 2001 From: Ryan Hsu Date: Fri, 5 Oct 2018 18:12:25 +0800 Subject: [PATCH] Update daily_rotating_file_sink.h Fix bug when rotates --- include/spdlog/sinks/daily_rotating_file_sink.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/spdlog/sinks/daily_rotating_file_sink.h b/include/spdlog/sinks/daily_rotating_file_sink.h index ff1fe779..258f7feb 100644 --- a/include/spdlog/sinks/daily_rotating_file_sink.h +++ b/include/spdlog/sinks/daily_rotating_file_sink.h @@ -61,10 +61,9 @@ public: protected: void sink_it_(const details::log_msg &msg) override { - today_filename_ = calc_filename(base_filename_, now_tm(msg.time)); - if (msg.time >= rotation_tp_) { + today_filename_ = calc_filename(base_filename_, now_tm(msg.time)); file_helper_.open(today_filename_, truncate_); rotation_tp_ = next_rotation_tp_(); }