Skip to content

Make tracing_subscriber::fmt::format::Writer::new public #2223

@TmLev

Description

@TmLev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions