Rust

pretty

Module

Spans as colourful, human-readable text.

Contents

use utopia_span::Pretty;
Rust
pub struct Pretty

Writes each span as a coloured block for local development: a header (action, duration, short trace id), the attributes other than span.* aligned in a column with level first, the error with at most max_trace_frames stack frames, and a separator line width wide. Spans with an error go to standard error, the others to standard output.

Rust
use utopia_span::{Pretty, Span};

let span = Span::new("db.query");
span.set("span.duration", 0.0123).set("rows", 3);
let text = String::from_utf8(Pretty::new().width(10).render(&span)).unwrap();
assert!(text.contains("12.3ms"));
assert!(text.contains("rows"));
Also implements Default, Debug.