我对此的理解是文件将被限制在指定的大小。但我不明白max_files = 3
,我们会有一个或三个文件吗?
我在这里运行示例并得到一个文件。
#include <iostream>
#include "spdlog/sinks/rotating_file_sink.h"
void rotating_example()
{
// Create a file rotating logger with 5mb size max and 3 rotated files
auto max_size = 1048576 * 5;
auto max_files = 3;
auto logger = spdlog::rotating_logger_mt("some_logger_name", "logs/rotating.txt", max_size, max_files);
logger->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name)");
}
int main()
{
rotating_example();
return 0;
}