Crates.io | emit |
lib.rs | emit |
version | 0.11.0-alpha.6 |
source | src |
created_at | 2015-08-08 09:03:14.543574 |
updated_at | 2024-06-28 00:23:03.000578 |
description | Structured diagnostics for Rust applications. |
homepage | |
repository | https://github.com/emit-rs/emit |
max_upload_size | |
id | 2786 |
size | 196,977 |
emit
is a framework for manually instrumenting Rust applications with an expressive syntax inspired by Message Templates.
emit
represents all diagnostics as events; a combination of timestamp or timespan, template, and properties. Traditional log records, spans in a distributed trace, and metric samples are all represented as events. Having a unified model of all these signals means you can always capture your diagnostics in one way or another.
[dependencies.emit]
version = "0.11.0-alpha.6"
[dependencies.emit_term]
version = "0.11.0-alpha.6"
use std::time::Duration;
fn main() {
let rt = emit::setup()
.emit_to(emit_term::stdout())
.init();
greet("Rust");
rt.blocking_flush(Duration::from_secs(5));
}
#[emit::span("Greet {user}")]
fn greet(user: &str) {
emit::info!("Hello, {user}!");
}
This is alpha-level software. It implements a complete framework but has almost no tests and needs a lot more documentation.
See the examples
directory and emit
documentation to get started with emit
.
Diagnostics produced by emit
are sent to an emitter. This repository currently implements the following emitters:
emit_term
for writing human-readable output to the console.emit_file
for writing JSON or another machine-readable format to rolling files.emit_otlp
for sending diagnostics to an OpenTelemetry compatible collector.emit_opentelemetry
for integrating emit
into an application using the OpenTelemetry SDK for its diagnostics.