Skip to content

Is it possible to control the tracing::instrument(ret) level, to make it different from the span's? #2328

Answered by hawkw
scullionw asked this question in Q&A
Discussion options

You must be logged in to vote

This isn't currently possible, but it would be a good feature request! We could add something like

#[tracing::instrument(ret(level = "debug"), level = "warn")]
fn whatever() -> ... {
   ...
}

to allow changing the level for the ret event.

We would probably want to do it by adding a ret(level = "<level>") rather than just ret = "<level>" to future-proof the macro interface, so that we can add additional configuration arguments beyond setting the return event's level.

I think this should be a fairly straightforward change, at least for someone who's familiar with procedural macros, if you're interested in implementing it?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@davidbarsky
Comment options

Answer selected by hawkw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants