You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, instrument macro uses debug format for all arguments on the function annotated.
However, sometimes the display version of the arguments is preferred as it's often more human friendly. The only current way to do so is to manually add each one to the fields argument with the display format specified. This is verbose, and error prone when modifying the function arguments.
e.g.
#[instrument(fields(a = %a, b = %b, c = %c, d = %d, ...)]
fn foo(a: Box<dyn Display>, b: Box<dyn Display>, ...) { ... }
Proposal
Add a new argument to instrument macro that allows specifies the format of the function arguments.
Example
Feature Request:
Crates
tracing_attributes
Motivation
Currently,
instrument
macro uses debug format for all arguments on the function annotated.However, sometimes the display version of the arguments is preferred as it's often more human friendly. The only current way to do so is to manually add each one to the
fields
argument with the display format specified. This is verbose, and error prone when modifying the function arguments.e.g.
Proposal
Add a new argument to
instrument
macro that allows specifies the format of the function arguments.Example
We can change this line. https://docs.rs/tracing-attributes/0.1.15/src/tracing_attributes/lib.rs.html#652
to not hard-code debug format.
Open to implementing this change if there's no objections to this feature.
Alternatives
display_instrument
The text was updated successfully, but these errors were encountered: