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
Allow custom rotation timings for logs. Right now only 3 types are available: hourly, daily and never. This is far too coarse to provide efficient logging. My particular use case, is a "watcher" application that monitors something every X ms (configured at the start), it would be incredibly nice if I could specify X ms (for example) per rotation, effectively making each log be one run of the "watch"
Proposal
Add another enum constructor with a std::time::Duration and do calculations based on that instead of fixed timesteps.
(chrono's DateTime<Tz> implements Add<Duration> for DateTime<Tz>, thererfore it's pretty direct.
This right now it's only associated const items that resolve to a variant of the enum Roation.
round_date needs to be changed to account for this, one way could be assuming the custom duration to be a divisor of the unrounded_date, and thus discarding the remainder, calculations should be done using nanoseconds for as much precision as possible.
join_date is a tricky one, I don't know how to approach the implementation of this.
Alternatives
There are many ways to go to implement this, the one in the proposal is how I'd do.
The text was updated successfully, but these errors were encountered:
Feature Request
Crates
tracing-appender
Motivation
Allow custom rotation timings for logs. Right now only 3 types are available: hourly, daily and never. This is far too coarse to provide efficient logging. My particular use case, is a "watcher" application that monitors something every X ms (configured at the start), it would be incredibly nice if I could specify X ms (for example) per rotation, effectively making each log be one run of the "watch"
Proposal
Add another enum constructor with a
std::time::Duration
and do calculations based on that instead of fixed timesteps.(chrono's
DateTime<Tz>
implementsAdd<Duration> for DateTime<Tz>
, thererfore it's pretty direct.This right now it's only associated const items that resolve to a variant of the enum
Roation
.round_date
needs to be changed to account for this, one way could be assuming the custom duration to be a divisor of theunrounded_date
, and thus discarding the remainder, calculations should be done using nanoseconds for as much precision as possible.join_date
is a tricky one, I don't know how to approach the implementation of this.Alternatives
There are many ways to go to implement this, the one in the proposal is how I'd do.
The text was updated successfully, but these errors were encountered: