I have initialized sink that logs to file:
logging::add_file_log
(
keywords::file_name = "sample_%N.log", /*< file name pattern >*/
keywords::rotation_size = 10 * 1024 * 1024, /*< rotate files every 10 MiB... >*/
keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), /*< ...or at midnight >*/
keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/
keywords::auto_flush = true
);
It looks it rewrites file during program restart. How to make it append to file?
The documentation says
open_mode The mask that describes the open mode for the file. See std::ios_base::openmode.
The openmode keywords::open_mode
for append is std::ios_base::app
, so it looks like you need to add it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With