mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-16 19:57:10 +00:00
37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
tracing-chrome
|
|
======
|
|
|
|
[](https://crates.io/crates/tracing-chrome)
|
|
[](https://docs.rs/tracing-chrome/)
|
|

|
|

|
|
|
|
# Overview
|
|
|
|
tracing-chrome is a Layer for [tracing-subscriber](https://crates.io/crates/tracing-subscriber) that outputs traces in Chrome's trace viewer format that can be viewed with `chrome://tracing` or [ui.perfetto.dev](https://ui.perfetto.dev).
|
|
|
|
# Usage
|
|
|
|
Add this near the beginning of `main`:
|
|
```rust
|
|
use tracing_chrome::ChromeLayerBuilder;
|
|
use tracing_subscriber::{registry::Registry, prelude::*};
|
|
|
|
let (chrome_layer, _guard) = ChromeLayerBuilder::new().build();
|
|
tracing_subscriber::registry().with(chrome_layer).init();
|
|
```
|
|
|
|
When `_guard` is dropped, your trace will be in a file like `trace-1668480819035032.json`.
|
|
|
|
Open that file with [ui.perfetto.dev](https://ui.perfetto.dev) (or `chrome://tracing`) and take a look at your pretty trace.
|
|
|
|

|
|
|
|
# License
|
|
|
|
Licensed under the [MIT license](http://opensource.org/licenses/MIT)
|
|
|
|
## Contributions
|
|
|
|
Unless you state otherwise, any contribution intentionally submitted for inclusion in the work shall be licensed as above.
|