command_span

Function command_span 

Source
pub fn command_span(name: &str) -> Span
Expand description

Creates a tracing span for command execution.

Spans help organize log messages by context. This is particularly useful for tracing execution flow and debugging complex operations.

§Arguments

  • name - The name of the span (typically the command name)

§Returns

A tracing span that will log entry/exit when trace level is enabled.

§Examples

use sublime_cli_tools::output::logger::{init_logging, command_span};
use sublime_cli_tools::cli::LogLevel;

init_logging(LogLevel::Trace, false)?;

let _span = command_span("bump");
tracing::info!("Executing bump command");
// Span automatically closes when dropped