You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found myself (and others) wanting to rotate log files based on a combination of two already-implemented conditions (file size and interval in my case). I see there is existing functionality to allow arbitrary logic in the rotation by passing in a generic callable, however that would have required me to re-implement much of loguru's existing rotator functionality (or import code from within the loguru source).
A cleaner approach would be to permit the specification of lists (or generic iterables) in the rotation argument, and then have loguru parse each element into a combined rotation rotation logic where a file will be rotated if any of the rotators evaluate to true.
Background
I found myself (and others) wanting to rotate log files based on a combination of two already-implemented conditions (file size and interval in my case). I see there is existing functionality to allow arbitrary logic in the rotation by passing in a generic
callable
, however that would have required me to re-implement much of loguru's existing rotator functionality (or import code from within the loguru source).A cleaner approach would be to permit the specification of lists (or generic iterables) in the
rotation
argument, and then have loguru parse each element into a combined rotation rotation logic where a file will be rotated if any of the rotators evaluate to true.Example
Would rotate log files every 12 hours or every 10 Megabytes. This is much easier for the end-user than creating a custom callable of the same logic.
I've submitted this PR
The text was updated successfully, but these errors were encountered: