tracing
tracing copied to clipboard
enabled! consults log::log_enabled! when appropriate
This is an attempt at fixing #2036. I am not confident this is the right way to do this and I have a few questions, but I figured I would put up a PR to get some guidance and feedback.
Motivation
Libraries and applications can use enabled!
to determine whether anyone is actually going to consume an expensive event before constructing it. However, currently enabled!
only factors in whether the event will be consumed as a tracing event, and not whether it would be consumed as a log message.
Solution
Update the macro to consult log::log_enabled
in cases where log
or log-always
is enabled and the event is not going to be emitted as a tracing event.
Sorry, this is taking me a minute to review. I'm trying to remember how Interest
and log
interact here, especially across feature flags.
I'm not likely to get back to this unfortunately, so closing out.