emabee / flexi_logger

A flexible logger for rust programs that can write to stderr, stdout, and/or to log files
Apache License 2.0
307 stars 50 forks source link

Method on LoggerHandle for manually forcing rotation? #147

Closed newpavlov closed 1 year ago

newpavlov commented 1 year ago

In my application I have commands for reading, copying, moving, and deleting log files. Right now it's implemented using existing_log_files, flush, reopen_output, and by working with files directly, but it's a bit too fragile for my taste. For example, I have to account for potential race conditions and partial writes.

It would be nice to have an ability to force rotation of current log files, so the application commands would work only with rotated files, thus skipping potential complications around current log file.