From b64e4464a77caca658982b8fe919db05c4f29f36 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Tue, 20 Nov 2018 10:26:10 +0200 Subject: [PATCH] Update current_size_ to 0 in after of truncating in rotation error --- include/spdlog/sinks/rotating_file_sink.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index 14fd0bb6..ef210d83 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -105,6 +105,7 @@ private: if (!rename_file(src, target)) { file_helper_.reopen(true); // truncate the log file anyway to prevent it to grow beyond its limit! + current_size_ = 0; throw spdlog_ex( "rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno); }