Macro log

Source
macro_rules! log {
    (logger: $logger:expr, $level:expr, $($arg:tt)+) => { ... };
    ($level:expr, $($arg:tt)+) => { ... };
}
Expand description

Logs a message at the specified level.

This macro will generically log with the specified Level and format! based argument list.

§Named optional parameters

NameTypeDescription
loggerArc<Logger> or LoggerIf specified, the given logger will be used instead of the global default logger.

§Examples

use spdlog::{log, Level};

let data = (42, "Forty-two");

// Using the global default logger
log!(Level::Info, "Received data: {}, {}", data.0, data.1);

// Or using the specified logger
log!(logger: app_events, Level::Info, "Received data: {}, {}", data.0, data.1);