trace!() { /* proc-macro */ }Expand description
Emits a trace-level event.
An optional first argument may provide an error implementing ErrorReport. Its display value
and source chain are recorded as exception.message; callers do not provide that attribute
themselves.
The event name is required and must be a string literal. When an error is provided, optional
target: and parent: arguments go between the error and name, in that order. Without an
error, they precede the name. 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_utils::tracing::trace;
trace!(target: "node", "block.received", block.number = 42_u32);
let source = std::io::Error::other("invalid block");
trace!(&source, "block.rejected", block.number = 42_u32);