# tracing::error - Rust
API documentation for the Rust `error` macro in crate `tracing`.
Keywords: rust, rustlang, rust-lang, error

# Macro tracing::error [−] [src]

    macro_rules! error {
        (target: $target:expr, parent: $parent:expr, { $($field:tt)* }, $($arg:tt)* ) => { ... };
        (target: $target:expr, parent: $parent:expr, $($k:ident).+ $($field:tt)+ ) => { ... };
        (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => { ... };
        (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => { ... };
        (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => { ... };
        (parent: $parent:expr, { $($field:tt)+ }, $($arg:tt)+ ) => { ... };
        (parent: $parent:expr, $($k:ident).+ = $($field:tt)*) => { ... };
        (parent: $parent:expr, ?$($k:ident).+ = $($field:tt)*) => { ... };
        (parent: $parent:expr, %$($k:ident).+ = $($field:tt)*) => { ... };
        (parent: $parent:expr, $($k:ident).+, $($field:tt)*) => { ... };
        (parent: $parent:expr, ?$($k:ident).+, $($field:tt)*) => { ... };
        (parent: $parent:expr, %$($k:ident).+, $($field:tt)*) => { ... };
        (parent: $parent:expr, $($arg:tt)+) => { ... };
        (target: $target:expr, { $($field:tt)* }, $($arg:tt)* ) => { ... };
        (target: $target:expr, $($k:ident).+ $($field:tt)* ) => { ... };
        (target: $target:expr, ?$($k:ident).+ $($field:tt)* ) => { ... };
        (target: $target:expr, %$($k:ident).+ $($field:tt)* ) => { ... };
        (target: $target:expr, $($arg:tt)+ ) => { ... };
        ({ $($field:tt)+ }, $($arg:tt)+ ) => { ... };
        ($($k:ident).+ = $($field:tt)*) => { ... };
        (?$($k:ident).+ = $($field:tt)*) => { ... };
        (%$($k:ident).+ = $($field:tt)*) => { ... };
        ($($k:ident).+, $($field:tt)*) => { ... };
        (?$($k:ident).+, $($field:tt)*) => { ... };
        (%$($k:ident).+, $($field:tt)*) => { ... };
        (?$($k:ident).+) => { ... };
        (%$($k:ident).+) => { ... };
        ($($k:ident).+) => { ... };
        ($($arg:tt)+) => { ... };
    }

Constructs an event at the error level.

This functions similarly to the `event!` macro. See the top-level documentation for details on the syntax accepted by this macro.

# Examples

    use tracing::error;

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

    error!(port, error = %err_info);
    error!(target: "app_events", "App Error: {}", err_info);
    error!({ info = err_info }, "error on port: {}", port);