Merge pull request #1128 from s-shin/hotfix/daily_file_sink_when_no_datetime

Fix rotation condition when SPDLOG_NO_DATETIME is defined.
This commit is contained in:
Gabi Melman 2019-07-01 12:21:33 +03:00 committed by GitHub
commit 6012d52fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,8 +67,11 @@ public:
protected: protected:
void sink_it_(const details::log_msg &msg) override void sink_it_(const details::log_msg &msg) override
{ {
#ifdef SPDLOG_NO_DATETIME
if (log_clock::now() >= rotation_tp_)
#else
if (msg.time >= rotation_tp_) if (msg.time >= rotation_tp_)
#endif
{ {
file_helper_.open(FileNameCalc::calc_filename(base_filename_, now_tm(msg.time)), truncate_); file_helper_.open(FileNameCalc::calc_filename(base_filename_, now_tm(msg.time)), truncate_);
rotation_tp_ = next_rotation_tp_(); rotation_tp_ = next_rotation_tp_();