Macro shadow_rs::log_once_per_value_at_level

source ·
macro_rules! log_once_per_value_at_level {
    ($value:expr, $t:ty, $lvl_once:expr, $lvl_remaining:expr, $str:literal $($x:tt)*) => { ... };
}
Expand description

Log a message once at level lvl_once for each distinct value, and any later log messages from this line with an already-logged value at level lvl_remaining.

A log target is not supported. The string “(LOG_ONCE)” will be prepended to the message to indicate that future messages won’t be logged at lvl_once.

The fast-path (where the given value has already been logged) aquires a read-lock and looks up the value in a hash table.

log_once_per_value_at_level!(unknown_flag, i32, Level::Warn, Level::Debug, "Unknown flag value {unknown_flag}");