ez_tracing

Crates.ioez_tracing
lib.rsez_tracing
version0.1.0
created_at2025-11-14 11:22:31.268979+00
updated_at2025-11-14 11:22:31.268979+00
descriptionTracing, made easy
homepage
repositoryhttps://github.com/IzawGithub/ez_tracing
max_upload_size
id1932619
size365,847
Izaw (IzawGithub)

documentation

README

ez_tracing

Tracing, made easy.

Do you want to structure debug information better than what dbg! gives you ?
Do you want to see what exactly happens in a multi-threaded program ?
Are you lost with the different crates that could solve these problem in a similar but not quite the same way, in the Rust ecosystem ?

Then this crate is for you!

Overview

This crate provides a convinient way to setup logs and trace, using an easily configurable Tracer struct.

Features

  • verbosity-*: Compile time choice of the Console default verbosity level. If multiple are choosed, this will select the lowest verbosity level. IE: Error before Warn. If none are chosen, this will default to Warn.

  • bon: Use bon builders to create structs. This is a nicer interface than using raw strucs, but it increases compile time.

  • chrono: Add the time as a prefix to the log files name.

  • clap: Enable configuring the Console from the CLI, using the clap library.

    • clap-log-file: Enable configuring the log files from the CLI.
  • serde: Enable creating Tracer and friends usings any Serde compatible de/serializer. This can be useful for configuration files.

  • telemetry: Enables exporting traces to an OpenTelemetry compatible server.

    • telemetry-auth: Connecting to an OpenTelemetry compatbile server that is protected by an authentication method.
  • tokio: Enable exporting traces to the Tokio console. You will need to add RUSTFLAGS="--cfg tokio_unstable" to your application during build time.

Examples

use ez_tracing::{errors::EErrorTracer, tracer::Tracer};

/// Log to `stdout` and `stderr` at the default `Warn` level
fn main() -> Result<(), EErrorTracer> {
    let _guard = Tracer::default().try_setup_tracer()?;
    # Ok(())
}

For a more thorough showcase, check out the tests folder, which also serves as examples.

Known issues

There is a known bug (#3309) in the tracing crates that makes the instrument macro unreachable after a re-export.
To fix this, you can add, to your top lib.rs file:

use ez_tracing::tracing::*;
extern crate self as tracing;

License

Apache2 or MIT, at your option.

Commit count: 0

cargo fmt