macro_rules! trace {
(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).+) => { ... };
(%$($k:ident).+) => { ... };
($($k:ident).+) => { ... };
($($arg:tt)+) => { ... };
}
Expand description
Constructs an event at the trace 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::trace;
let pos = Position { x: 3.234, y: -1.223 };
let origin_dist = pos.dist(Position::ORIGIN);
trace!(position = ?pos, ?origin_dist);
trace!(
target: "app_events",
position = ?pos,
"x is {} and y is {}",
if pos.x >= 0.0 { "positive" } else { "negative" },
if pos.y >= 0.0 { "positive" } else { "negative" }
);