Hi,
This problem is not related to MFC.
C++ standard library only provides simple I/O functions.
According to your requirements, it is recommended to search for Log-related open-source libraries on GitHub.
It's easy to find some sample.
console_sink->set_level(spdlog::level::warn);
// Create a file rotating logger with 5 MB 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);
}
// Create a daily logger - a new file is created every day at 2:30 am
auto logger = spdlog::daily_logger_mt("daily_logger", "logs/daily.txt", 2, 30);
Since Q&A does not provide support on how to use third-party libraries, for questions about these libraries, you can seek help on GitHub or StackOverflow.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.