davidbarsky / tracing-tree

Apache License 2.0
121 stars 29 forks source link

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

Open ten3roberts opened 9 months ago

ten3roberts commented 9 months ago

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

davidbarsky commented 9 months ago

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.)