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
A new argument to instrument, that skips all arguments to the function, that the attribute macro is applied to. Similarly, a instrument argument that only shows certain parts of a value (basically, a combination of skip_all and fields).
Crates
tracing
Motivation
Often, the arguments that I pass to functions are complex/verbose. It would be nice, if it was possible to skip all arguments in one go. Then we could use fields to select only the data that is relevant.
Similarly, an only / extract / include argument could skip everything, and select/transform what is wanted (as mentioned, a combination of skip_all and fields).
...but I don't know if it would be possible to implement something like this in a generic way (without being tied to only structs).
Proposal
How should the new feature be implemented, and why? Add any considered
drawbacks.
I have no idea. Unfortunately, at the moment, I have not learned how to use procedural macros yet (which also means, that I couldn't implement this myself, at the moment).
Alternatives
Currently, arguments to skip have to be specified via skip and then fields to include have to be defined via fields, which is more cumbersome than what I propose.
The text was updated successfully, but these errors were encountered:
d4h0
changed the title
Feature: #[instrumen(skip_all)] / #[instrument(only(foo.bar, foo.baz))]
Feature: instrument(skip_all)] / instrument(only(foo.bar, foo.baz))
Mar 1, 2021
Feature Request
A new argument to
instrument
, that skips all arguments to the function, that the attribute macro is applied to. Similarly, ainstrument
argument that only shows certain parts of a value (basically, a combination ofskip_all
andfields
).Crates
tracing
Motivation
Often, the arguments that I pass to functions are complex/verbose. It would be nice, if it was possible to skip all arguments in one go. Then we could use
fields
to select only the data that is relevant.Similarly, an
only
/extract
/include
argument could skip everything, and select/transform what is wanted (as mentioned, a combination ofskip_all
andfields
).With my proposal this:
... would become:
Even better would something like this:
...but I don't know if it would be possible to implement something like this in a generic way (without being tied to only
struct
s).Proposal
I have no idea. Unfortunately, at the moment, I have not learned how to use procedural macros yet (which also means, that I couldn't implement this myself, at the moment).
Alternatives
Currently, arguments to skip have to be specified via
skip
and then fields to include have to be defined viafields
, which is more cumbersome than what I propose.The text was updated successfully, but these errors were encountered: