tracing::instrument not logging #2290
Replies: 3 comments 2 replies
-
The behavior of logging here depends on what subscriber you're using. If you're using tracing-subscriber, it will by default only log when an event occurs. If you'd like to change this behavior, try using https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Layer.html#method.with_span_events. |
Beta Was this translation helpful? Give feedback.
-
To expand a little bit on @davidbarsky's answer, the When you add the As David mentioned, you can also use Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answers, that makes sense. I think instrument is not what I'm really looking for, probably just simple Another question, when using span since you need to provide a level I assume the span will only be created when that level is enabled. So if I use different event macros like |
Beta Was this translation helpful? Give feedback.
-
I thought that
#[tracing::instrument(level = "debug", skip(self))]
would always make a log entry of the arguments, but it doesn't.
I found out that if I add
ret
to the instrument "call" I get a log entry.Am I doing something wrong or is that intended?
Background
I'm implementing a tonic service which the return value is an empty struct so i emitted the
ret
from the instrument call, since it doesn't bring any value to the log entry.Beta Was this translation helpful? Give feedback.
All reactions