add argument to rotating file sink for rotate_on_open

when true, the log file will be rotated when it is opened so the newly constructed file will start off being empty
This commit is contained in:
Philip Miller
2018-09-06 02:47:48 -04:00
parent caff7296b1
commit 52a01b2cf2
2 changed files with 8 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ TEST_CASE("rotating_file_logger2", "[rotating_logger]]")
prepare_logdir();
size_t max_size = 1024 * 10;
std::string basename = "logs/rotating_log";
auto logger = spdlog::rotating_logger_mt("logger", basename, max_size, 1);
auto logger = spdlog::rotating_logger_mt("logger", basename, max_size, 1, true);
for (int i = 0; i < 10; ++i)
logger->info("Test message {}", i);