| Crates.io | ez_tracing |
| lib.rs | ez_tracing |
| version | 0.1.0 |
| created_at | 2025-11-14 11:22:31.268979+00 |
| updated_at | 2025-11-14 11:22:31.268979+00 |
| description | Tracing, made easy |
| homepage | |
| repository | https://github.com/IzawGithub/ez_tracing |
| max_upload_size | |
| id | 1932619 |
| size | 365,847 |
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!
This crate provides a convinient way to setup logs and trace, using an easily configurable Tracer struct.
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.
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.
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;