tracing

Macro span_enabled

Source
macro_rules! span_enabled {
    ($($rest:tt)*) => { ... };
}
Expand description

Tests whether a span with the specified level and target would be enabled.

This is similar to enabled!, but queries the current subscriber specifically for an event, whereas enabled! queries for an event or span.

See the documentation for [enabled!] for more details on using this macro. See also span_enabled!.

ยงExamples

if span_enabled!(target: "my_crate", Level::DEBUG) {
    // some expensive work...
}
// simpler
if span_enabled!(Level::DEBUG) {
    // some expensive work...
}
// with fields
if span_enabled!(Level::DEBUG, foo_field) {
    // some expensive work...
}