Skip to main content Skip to main content
Pigweed's logo Pigweed
  1. Home
  2. Reference
  3. Rust
  4. pw_log
  5. logf

logf

Macro logf 

Source
macro_rules! logf {
    ($log_level:expr, $format_string:literal $(,)?) => { ... };
    ($log_level:expr, $format_string:literal, $($args:expr),* $(,)?) => { ... };
}
Expand description

Emit a log message using printf format string semantics.

logf takes 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::{logf, LogLevel};

logf!(LogLevel::Info, "Log fact: A %s log has a Janka hardness of %d lbf.",
    "Spruce Pine", 700);