[−][src]Crate tracing_callgraph
A tracing Layer for generating a call graphs.
Overview
tracing
is a framework for instrumenting Rust programs to collect
scoped, structured, and async-aware diagnostics. tracing-callgraph
provides helpers
for consuming tracing
instrumentation that can later be visualized as a
call graph in Graphviz dot
representation.
Layer Setup
use tracing_callgraph::GraphLayer; use tracing_subscriber::{registry::Registry, prelude::*}; fn setup_global_subscriber() -> impl Drop { let (graph_layer, _guard) = GraphLayer::with_file("./output.dot").unwrap(); let subscriber = Registry::default().with(graph_layer); tracing::subscriber::set_global_default(subscriber).expect("Could not set global default"); _guard } #[tracing::instrument] fn outer_a() { inner() } #[tracing::instrument] fn outer_b() { inner() } #[tracing::instrument] fn inner() {} fn main() { let _ = setup_global_subscriber(); outer_a(); outer_b(); }
Structs
Error | The error type for |
FlushGuard | An RAII guard for flushing a writer. |
GraphLayer | A |