Closed newpavlov closed 1 year ago
Just wanted to start acting on this PR ... I didn't want to extend the LogWriter trait today, so I included only the core functionality in the upcoming patch version, but that was not supposed to mean it should not be done.
I think the trigger_rotation
method added in the other commit should be sufficient for me. I only extended the trait because it looked like the most straightforward way to implement the functionality. And with the number of conflicts, I think it will be easier for you to start from scratch than change this PR.
It would be nice to get something like rotated_log_files
later, but for now I can simply filter output of existing_log_files
.
There is one minor issue with manual rotation, which I am not sure how to fix properly. When you rotate file and immediately get list of log files you sometimes get non-compressed log files, even though I use Cleanup::KeepCompressedFiles
. To work around it in my code I added a simple waiting loop which stops when list of files does not contain any non-compressed rotated files.
I wanted to rework method existing_log_files so that it
Would that fit?
Yes, it would be great! Maybe it's also worth to add an option to trigger_rotation
to wait for all triggered cleanups to finish? Or do it by default?
Good idea, thanks!
Closes #147