Is there interest in adding a file size criteria in tracing_appender
#2823
isc-mfortuna
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I noticed that while the
tracing_appender
crate rotates file based on the date, it does not (I think) support file rotation based on the file size.The most backwards compatible implementation I can think of is adding a
size: u64
field to thetracing_appender::rolling::Rotation
struct. Then, logic would be updated intracing_appender::rolling::Inner::should_rollover
to check for file size if that criteria is set.Another idea could be to create an new trait called
Criteria
which exposes the methodfn should_rollover(inner: &Inner) -> bool
. We could then parameterize the Inner struct with a generic bounded to that trait, and then implementshould_rollever
for the various rollover types which implementCriteria
.Something like
The above solution could prevent a runtime check in
should_rollover
by allowing types suchTemporalRotationPolicy
(which already exists in the form of theRotationKind
enum) and StorageRotationPolicy to implement their version ofshould_rollover
.I am sure this could be improved. I am new to Rust and apologize in advance. I am interested in learning the best approach.
If there is interest in this feature, I can try to make a pull request.
Beta Was this translation helpful? Give feedback.
All reactions