Closed mooreniemi closed 3 years ago
I've worked through my confusion now. Just generating the span doesn't itself log anything. It just creates a context in which the logged events would happen. So if the future I instrumented with an info_span
(what I'm actually doing) doesn't itself log anything, I won't see anything via logs_contain
. Once I added something inside the future I saw the log as expected.
Hehe, yeah. That gotcha also bit me a few times 🙂 Good that you could figure it out!
Hi, I'm a newbie to Rust and learning the tracing library. I don't have a great mental model yet, so I apologize if this ends up being very obvious once I get that.
I wanted to use this crate to check log output where I am using the
info_span!
anderror_span!
but it doesn't work as I'd expect. I'd expect all spans to still be getting intercepted by the global write buffer such that I can check them withlogs_contain
.I'm going to try to understand and report back here why this would be, but if you intercept this first maybe it can go into the documentation?
Using the documented setup I can see
tracing::info!
just fine in a test, but nottracing::info_span!
:What I see in logs: