macro_rules! logf_if {
($condition:expr, $log_level:expr, $format_string:literal $(,)?) => { ... };
($condition:expr, $log_level:expr, $format_string:literal, $($args:expr),* $(,)?) => { ... };
}Expand description
Emit a log message using printf format string semantics if condition is true.
logf_if takes an expr condition, a LogLevel, a printf style format string,
and necessary arguments to that string and emits a log message to the logging backend.
use pw_log::LogLevel;
use log_if::logf_if;
const LOG_FACTS: bool = true;
logf_if!(LOG_FACTS, LogLevel::Info, "Log fact: A %s log has a Janka hardness of %d lbf.",
"Spruce Pine", 700);