-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
want way to ask #[instrument] to trace the return value #1281
Comments
Something like this would definitely be nice, and should be doable (using the same techniques we use for |
Thanks. I've put it on my list but it might be a while before it gets to the top. |
hi @hawkw , @ijackson , I recently opened an issue #1630 and a PR #1631 for adding |
I want this feature very much so will work on this next week. In order to implement tracing/tracing-attributes/src/attr.rs Lines 10 to 19 in b439705
|
Hi @hkmatsumoto , allow me to jump in. Yes you are on right track. That struct is the representation of the parsed arguments of Feel free to check the changes and discussion in #1631, there will be lots of inspiration points. Basically you'll need to determine presence and mode of To debug your implementation, I suggest using VS Code's "expand macro recursively" feature (after a code change you may need to close and reopen VSCode due to some limitation, though), possibly on a test example function you'll add https://github.com/tokio-rs/tracing/pull/1631/files#diff-74a47b15914675cd4c2a0c370bbec4a3d2d6e50d939dda795497ec67de050e8fR178-R181 and examine the expansion output. |
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 useerr
to print theErr
of aResult
).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.The text was updated successfully, but these errors were encountered: