error

Macro error 

Source
macro_rules! error {
    ($($input:tt)+) => { ... };
}
Expand description

Logs a message at the error level.

§Named optional parameters

Named optional parameters are parameters for logging macros to configure this log record.

Each parameter is optional and no order is required. It can appear at the beginning or end of a log macro argument list, but cannot appear among the formatting arguments.

NameType / Basic SyntaxDescription
loggerArc<Logger> or LoggerIf specified, the given logger will be used instead of the global default logger.
kv{ key = value }Key-value pairs for structured logs. See documentation of module kv for more.

§Examples

use spdlog::error;

let (err_info, port) = ("No connection", 22);

// Using the global default logger
error!("error: {} on port {}", err_info, port);

// Or using the specified logger, and structured logging
error!(logger: app_events, "app error", kv: { reason = err_info, port });