Macro tetcore_tracing::enter_span[][src]

macro_rules! enter_span {
    ( $span:expr ) => { ... };
    ( $lvl:expr, $name:expr ) => { ... };
}
Expand description

Enter a span.

The span will be valid, until the scope is left. Use either level and name or pass in any valid tetcore_tracing::Span for extended usage. The span will be exited on drop – which is at the end of the block or to the next enter_span! calls, as this overwrites the local variable. For nested usage or to ensure the span closes at certain time either put it into a block or use within_span!

Example

tetcore_tracing::enter_span!(tetcore_tracing::Level::TRACE, "test-span");
// previous will be dropped here
tetcore_tracing::enter_span!(
	tetcore_tracing::span!(tetcore_tracing::Level::DEBUG, "debug-span", params="value"));
tetcore_tracing::enter_span!(tetcore_tracing::info_span!("info-span",  params="value"));

{
	tetcore_tracing::enter_span!(tetcore_tracing::Level::TRACE, "outer-span");
	{
		tetcore_tracing::enter_span!(tetcore_tracing::Level::TRACE, "inner-span");
		// ..
	}  // inner span exists here
} // outer span exists here