Open
Description
Feature Request
Motivation
anyhow
provides a formatting of the whole error chain through the alternate selector {:#}
: https://docs.rs/anyhow/1.0.38/anyhow/struct.Error.html#display-representations
It would be nice to make use of this within tracing events in a concise way.
Proposal
Add a formatter sigil (possibly #
) to tracing that allows to print values using their alternate Display
implementation.
For example:
let error = anyhow!("Oh noes!").context("Something went horribly wrong!");
tracing::error!(#error, "What a mess")
Would print as:
ERROR What a mess error=Something went horribly wrong!: Oh noes!
Alternative
One can convert an anyhow error into a std-error. If reporting std-errors were to be made more ergonomic AND tracing provides a way of printing all causes of std-errors, then this feature is not needed. That being said, triggering the alternative Display
impl is not specific to anyhow and might be useful in general.
Metadata
Metadata
Assignees
Labels
No labels