> Though a micro optimization possible would be, for rotate > 0 do the file renaming after older files have been purged so that one less file needs to be globed :smile:.

I'm not really sure what you mean with "globed". My non native english is failing me here. :grimacing:

Having the renaming after the rotate was the original version. I decided against it for two reasons:

- Manipulating the `.log` file could be handled in two places – before and after the rotate, now it is a single place before the rotate.
- Having the renaming occurring later means you have a "delete files minus one because somewhere later something happens that's not clear right now" which leads to an awkward -1 testing in the rotate part.
- The `glob` lists the directory with one more file but this file is never touched otherwise.