Crates.io | debug-rs |
lib.rs | debug-rs |
version | 0.1.3 |
source | src |
created_at | 2017-08-08 09:45:29.005299 |
updated_at | 2017-08-09 01:33:55.037966 |
description | A debug crate for rust inspired by NodeJS debug module, colored, including crate name, file name and line, filtered by glob patterns. |
homepage | |
repository | https://github.com/zaaack/debug-rs/ |
max_upload_size | |
id | 26845 |
size | 7,991 |
A debug crate for rust inspired by NodeJS debug module.
debug-rs = "*"
or using cargo-edit
cargo add debug-rs
Here is the code in examples folder:
#[macro_use]
extern crate debug_rs;
fn main() {
debug!(666, 33, "aaa");
debug!(vec![1, 2, 3]);
}
Then run with environment variable DEBUG=debug
(because the examples' package name is still debug
):
If environment variable DEBUG
is undefined, then it won't print anything.
Running with env variables in windows shell might be a little different:
DEBUG=*,-not_this cargo run // for *unix
// or
set DEBUG=*,-not_this; cargo run // for windows
// or
$env:DEBUG = "*,-not_this"; cargo run // for PowerShell
Single glob pattern for <package name>:<file name>
: e.g. DEBUG=debug*
Multi glob patterns separated by comma: e.g. DEBUG=debug:examples*,hyper*,
Exclude global patterns by prefix "-": e.g. DEBUG=*,-not_this*
<package name>:<file name>:L<line number> ...custom variables
debug_build_only
feature can make debug macro won't generate any code in release mode, and default is turn on. you can disable it by config features in Cargo.toml.
Working in release mode:
[dependencies]
debug-rs = { version = "*", default-features=false }
Controlled by features:
[dependencies]
debug-rs = { version = "*", default-features=false, features=["disable"] }
MIT