Macro tracelogging::provider_enabled
source · macro_rules! provider_enabled { ($provider_symbol:ident, $level:expr, $keyword:expr) => { ... }; }
Expand description
Returns true if a write_event!
macro using the specified PROVIDER_SYMBOL,
level, and keyword would be enabled, false if it would be disabled.
Usage: let enabled = provider_enabled!(PROVIDER_SYMBOL, level, keyword);
The PROVIDER_SYMBOL
parameter should be the original symbol name created by
define_provider!
, not a reference or alias.
The level and keyword parameters must be compile-time constant expressions.
Note that write_event!
already checks whether the tracepoint is enabled – it
skips evaluating the field value expressions and skips sending the event if the
tracepoint is not enabled. You only need to make your own call to
provider_enabled!
if you want to control something other than write_event!
.
Implementation details: For ETW, this macro is implemented as a call to
PROVIDER_SYMBOL.enabled(level, keyword)
.