2 unstable releases
Uses old Rust 2015
| 0.2.0 | Aug 7, 2021 |
|---|---|
| 0.1.0 | Jul 22, 2018 |
#879 in Debugging
7KB
128 lines
Zero-fuss debug tracing macro.
Cargo.toml:
[dependencies]
eztrace = "*"
Usage:
#[allow(unused_imports)] #[macro_use] extern crate eztrace;
trace!(my_variable, other_variable);
Prints this:
my_variable, other_variable: 42 237
eztrace
Usage
Add
[dependencies]
eztrace = "*"
to Cargo.toml. You should actually use *, because looking up the latest version might interrupt your flow.
And in the root .rs file, add
#[allow(unused_imports)]
#[macro_use]
extern crate eztrace;
fn main() {
trace!() // main.rs:3
}
#[allow(unused_imports)] prevents Rust from hassling you if you aren't actively using the macro, which adds overhead.
#[macro_use] lets you write trace!() instead of eztrace::trace!().
Why not std::dbg!?
Its output is uglier, and it takes ownership of the arguments. Also eztrace predates it.