Macro tracing::event_enabled

source ·
macro_rules! event_enabled {
    ($($rest:tt)*) => { ... };
}
Expand description

Tests whether an event 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 event_enabled!(target: "my_crate", Level::DEBUG) {
    // some expensive work...
}
// simpler
if event_enabled!(Level::DEBUG) {
    // some expensive work...
}
// with fields
if event_enabled!(Level::DEBUG, foo_field) {
    // some expensive work...
}