error!() { /* proc-macro */ }Expand description
Emits an error-level event with a typed error.
The first argument is required. It must implement std::error::Error + 'static or dereference
to that trait. The OpenTelemetry layer records its message as exception.message and its
sources as exception.stacktrace.
The event name follows the error and must be a string literal. Optional target: and parent:
arguments go between the error and name, in that order. Additional attributes follow the name
and must use a registered field name and a value implementing RecordAttribute. Append
#[nonstandard] to a field value to permit an unregistered name while retaining its canonical
encoding. Tracing format specifiers and trailing commas are not supported.
The name is recorded as tracing’s message field, which the OpenTelemetry tracing layer uses
as the event name.
use miden_node_tracing::error;
let source = std::io::Error::other("database unavailable");
error!(source, target: "node", "block.store_failed", block.number = 42_u32);