A tracing library for generating call graphs in Graphviz dot
representation.
```rust use tracingcallgraph::GraphLayer; use tracingsubscriber::{prelude::*, registry::Registry};
fn setupglobalsubscriber() -> impl Drop { let (graphlayer, _guard) = GraphLayer::withfile("./output.dot").unwrap(); let subscriber = Registry::default().with(graph_layer);
tracing::subscriber::set_global_default(subscriber).expect("Could not set global default");
_guard
}
fn outer_a() { inner() }
fn outer_b() { inner() }
fn inner() {}
fn main() { let guard = setupglobalsubscriber(); outera(); outer_b(); } ```
Output
digraph {
0 [ label = "\"outer_a\"" ]
1 [ label = "\"inner\"" ]
2 [ label = "\"outer_b\"" ]
0 -> 1 [ label = "1" ]
2 -> 1 [ label = "1" ]
}
Special thanks to the authors of tracing-flame which this draws on heavily.