5 releases

new 0.11.0-alpha.5 Jun 13, 2024
0.11.0-alpha.4 Jun 12, 2024
0.11.0-alpha.3 Jun 8, 2024
0.11.0-alpha.2 Jun 7, 2024
0.11.0-alpha.1 Jun 6, 2024

#814 in Debugging

Download history 398/week @ 2024-06-03 300/week @ 2024-06-10

698 downloads per month

MIT/Apache

150KB
2.5K SLoC

emit_term

term

Current docs

Emit diagnostic events to the console.

This library implements a text-based format that's intended for direct end-user consumption, such as in interactive applications.


lib.rs:

Emit diagnostic events to the console.

This library implements a text-based format that's intended for direct end-user consumption, such as in interactive applications.

Getting started

Add emit and emit_term to your Cargo.toml:

[dependencies.emit]
version = "0.11.0-alpha.5"

[dependencies.emit_term]
version = "0.11.0-alpha.5"

Initialize emit using emit_term:

fn main() {
let rt = emit::setup()
.emit_to(emit_term::stdout())
.init();

// Your app code goes here

rt.blocking_flush(std::time::Duration::from_secs(30));
}

emit_term uses a format optimized for human legibility, not for machine processing. You may also want to emit diagnostics to another location, such as OTLP through emit_otlp or a rolling file through emit_file for processing. You can use emit::Setup::and_emit_to to combine multiple emitters:

fn main() {
let rt = emit::setup()
.emit_to(emit_term::stdout())
.and_emit_to(some_other_emitter())
.init();

// Your app code goes here

rt.blocking_flush(std::time::Duration::from_secs(30));
}

Dependencies

~2–10MB
~101K SLoC