Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. log_if
  6. warn_if

warn_if

Macro warn_if 

Source
macro_rules! warn_if {
    ($condition:expr, $($args:expr),* $(,)?) => { ... };
}
Expand description

Emit a warn level log message using core::fmt format string semantics if condition is true.

use log_if::warn_if;

const LOG_FACTS: bool = true;
warn_if!(
    LOG_FACTS,
    "Log Fact: Made from a log, an {} year old dugout canoe is the oldest discovered boat in {}.",
    8000 as i32, "Africa" as &str);