[−][src]Macro async_log::span
Create a tracing span.
Spans are pairs of trace!
logs. Every span
wraps a block, and logs a message at the start,
of the block and a message after the block has finished. This works in asynchronous contexts
too.
Each span takes a name
, a block, and optionally a list of key-value pairs in between those.
Once structured logging becomes part of log
(currently feature gated as kv_unstable
), we'll
move to support arbitrary key-value pairs.
Because of the way this macro is constructed, we currently support up to 9 key-value pairs. Which makes a total of 12 arguments.
Examples
use async_log::span; use log::info; span!("main", { let x = "foo"; info!("this {}", x); span!("inner, x={}", x, { info!("we must go deeper {}", x); }); })