mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user