Function color_spantrace::colorize

source ·
pub fn colorize(span_trace: &SpanTrace) -> impl Display + '_
Expand description

Display a SpanTrace with colors and source

This function returns an impl Display type which can be then used in place of the original SpanTrace when writing it too the screen or buffer.

Example

use tracing_error::SpanTrace;

let span_trace = SpanTrace::capture();
println!("{}", color_spantrace::colorize(&span_trace));

Note: colorize sets the global theme implicitly, if it was not set already. So calling colorize and then set_theme fails