Skip to content

want way to ask #[instrument] to trace the return value #1281

@ijackson

Description

@ijackson

Feature Request

Crates

tracing-attributes

Motivation

Tracing's #[instrument] is very nice for printf-style debugging as well as post-hoc analysis. But as far as I can tell it does not print the return value of the annotated function (although you can use err to print the Err of a Result).

Proposal

I suggest #[instrument(return)] to make it print the return value on function exit.

Alternatives

Adding a dbg! call to the call sites seems the most obvious workaround but is far less convenient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/attributesRelated to the `tracing-attributes` cratekind/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions