Skip to content

tracing-subscriber: add Tokio-based uptime for FormatTime implementation #3492

@zphrs

Description

@zphrs

Feature Request

An implementation of FormatTime which uses tokio::time::Instant and counts up.

Crates

tracing-subscriber

Motivation

Useful for logging within simulators which pause and manipulate the time within tokio runtimes, such as turmoil. This would allow for printing out time while still having deterministic log outputs. This would also be useful to log out time-shift when testing communication between multiple cooperating paused runtimes, like how turmoil treats servers.

Proposal

Verbatim the same implementation of Uptime but uses tokio::time::Instant instead. I'm unsure if it should be behind a feature flag or not to ensure that we don't pull in all of tokio if someone doesn't need this particular formatter.

Alternatives

Include such a formatter in tokio instead. This would make it harder to discover.

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