#tracing #terminal #cli

tracing-fancytree

tracing subscriber with readable tree output

1 unstable release

new 0.1.0 Jan 20, 2025

#202 in #tracing

GPL-3.0 license

600KB
367 lines

tracing-fancytree

a tracing-subscriber layer that prints very pretty and understandable trees, with symbols and colors

screenshot

usage

add the tracing, tracing-subscriber, and tracing-fancytree crates to Cargo.toml

fn main() {
	{
		use {
			::std::io::IsTerminal,
			::tracing_subscriber::layer::{Layer, SubscriberExt},
		};

		let out = ::std::io::stdout();
		let use_ansi = out.is_terminal();
		let use_symbols = out.is_terminal();

		::tracing::subscriber::set_global_default(
			::tracing_subscriber::registry().with(
				::tracing_fancytree::FancyTree::new(out, use_ansi, use_symbols),
			),
		)
		.unwrap();
	}

	// ...
}

Dependencies

~1–8MB
~58K SLoC