ryapric / loggit

Modern Logging for the R Ecosystem
Other
37 stars 2 forks source link

rotating logs #1

Closed RMHogervorst closed 4 years ago

RMHogervorst commented 6 years ago

Hi Ryan,

Is there a way to set rotating logs? Loggit appends now, but wouldn't it be nice if you could rotate the logs?

ryapric commented 6 years ago

Sure, I can see use for that, especially if a lot of logs are being written out.

Maybe a rotator function that notifies that logs are "stale", based on a user-defined period, and an argument to write old logs somewhere else or delete them? Even call it logrotate(), for the sake of *nix consistency.

ryapric commented 6 years ago

In the meantime, you can use the latest dev version's get_logs(), and filter/write them out. Cumbersome, but will be addressed when the above is introduced.

ryapric commented 4 years ago

rotate_logs() will now handle this in v2.0.0. It will technically be a performance risk, as well as being manually-invoked (to alleviate those performance issues), but better automation of that might come in a later minor-version bump.

ryapric commented 4 years ago

This is now done, tested, and documented. Onus of rotation logic will be on the developer to trigger in their own code, to keep loggit as unobtrusive as possible.