-
Notifications
You must be signed in to change notification settings - Fork 847
Open
Description
Feature Request
Find some more ergonomic way to report std::error::Error values.
Crates
tracing
Motivation
Logging a type that implements std::error::Error is currently quite awkward.
Value is only implemented for dyn std::error::Error.
That means logging a concrete type involves awkward type gymanstics for something that is a very common operation.
(unless I'm missing some trick here...)
EG:
// Inline
info!(error = &err as &dyn std::error::Error, "msg");
// Helper variable
let error: &dyn std::error::Error = &err;
info!(error, "msg");Proposal
Not sure what would be the best way to implement this.
A generic default impl is probably out of the question without specialization.
The most straight-forward solution would probably be a new formatter sigil, eg !.
warn!( error = !err, "msg");let4be, lilyball, vilgotf, daprilik, TheOnlyMrCat and 1 more
Metadata
Metadata
Assignees
Labels
No labels