tracing-tree icon indicating copy to clipboard operation
tracing-tree copied to clipboard

Allow time formatting of events through `time::formatting::Formattable`

Open ten3roberts opened this issue 2 years ago • 1 comments

The current implementation of event time formatting only allows for the default date time formatting 2023-10-11 13:57:26.676558 +02:00:00 which can be very verbose and creates long lines in the terminal output.

Proposal

Add an extra field to UtcDateTime and LocalDateTime that allows the user to specify their own time formatter using https://docs.rs/time/latest/time/formatting/trait.Formattable.html

This would allow timestamps such as 13:57:26 or other user preference

ten3roberts avatar Oct 11 '23 12:10 ten3roberts

Sorry for the delay. I agree that we should provide customization, but my preference is to expose this through tracing_subscriber::fmt::time::FormatTime interface, which will function as a superset of time::formatting::Formattable.

(We have unreleased changes to tracing-subscriber that re-introduces support for chrono and my personal preference for tracing-subscriber, going forward, would be to use chrono instead of time.)

davidbarsky avatar Oct 23 '23 12:10 davidbarsky