tracing
tracing copied to clipboard
Make `tracing_subscriber::fmt::format::Writer::new` public
Feature Request
Crates
https://github.com/tokio-rs/tracing https://github.com/davidbarsky/tracing-tree
Motivation
I'm using tracing-tree
, but it lacks timestamps. I opened an issue in tracing-tree
about it and @davidbarsky suggested that FormatTime
can be used as part of the implementation.
When trying to add support for it, I stumbled upon Writer
which is needed for calling FormatTime::format_time
. However, Writer
has only one private constructor and cannot be instantiated outside the tracing-subscriber
crate, which is quite limiting.
Proposal
Simple solution would be to make constructor entirely public, as suggested in TODO by @hawkw.
Alternatives
Another solution is to (maybe) add custom constructor that accepts String
, for instance. This eliminates the need for making existing constructor public, but Writer::new(&'writer mut impl fmt::Write)
seems to be more flexible.