| Crates.io | debug-log |
| lib.rs | debug-log |
| version | 0.3.1 |
| created_at | 2022-11-18 15:40:42.376066+00 |
| updated_at | 2024-01-05 08:04:07.105245+00 |
| description | dbg! and eprintln! that only run on debug mode. WASM is supported. |
| homepage | https://github.com/zxch3n/debug-log |
| repository | https://github.com/zxch3n/debug-log |
| max_upload_size | |
| id | 717941 |
| size | 12,584 |
debug-log
Simple log utils for debugging in Rust.
DEBUG environment variable is set. You
can change the DEBUG value in runtime as well by set_debug.DEBUG="filename". Match all by using
DEBUG="", or DEBUG="*"debug_groupThe output log is super easy to read on VS Code with sticky scroll enabled.
use debug_log::{debug_dbg, debug_log, group, group_end};
fn main() {
group!("A Group");
{
group!("Sub A Group");
let arr: Vec<_> = (0..3).collect();
debug_dbg!(&arr);
{
group!("Sub Sub A Group");
debug_dbg!(&arr);
group_end!();
}
debug_log!("Hi");
debug_dbg!(&arr);
group_end!();
}
{
group!("B Group");
debug_log!("END");
group_end!();
}
group_end!();
}
Run with DEBUG=* cargo run
Output
A Group {
Sub A Group {
[src/lib.rs:144] &arr = [
0,
1,
2,
]
Sub Sub A Group {
[src/lib.rs:147] &arr = [
0,
1,
2,
]
}
[src/lib.rs:150] Hi
[src/lib.rs:151] &arr = [
0,
1,
2,
]
}
B Group {
[src/lib.rs:157] END
}
}