File: README.md

package info (click to toggle)
rust-rs-tracing 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104 kB
  • sloc: makefile: 4
file content (26 lines) | stat: -rw-r--r-- 763 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Traces to Chrome's [trace_event format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)

## Example ##

Cargo.toml:
```toml
rs_tracing = { version = "1.0", features = ["rs_tracing"] }
```
main.rs:
```Rust
fn main() {
    open_trace_file!(".").unwrap();
    {
        trace_scoped!("complete","custom data":"main");
        trace_expr!("trace_expr", println!("trace_expr"));
        trace_begin!("duration");
        println!("trace_duration");
        trace_end!("duration");
    }
    close_trace_file!();
}
```
also possible to add custom data to all the macros formated like
the [serde_json::json!](https://docs.serde.rs/serde_json/macro.json.html) macro e.g.

    trace_scoped!("complete","custom":230,"more":"data");