Rust log implementation that logs to stderr based on verbosity specified supports macros and colors
Rust
33
193 commits
updated Jul 9, 2024
Logger that aims to provide a simple case of
env_logger that just
logs to stderr based on verbosity.
For a working example for StructOpt, clap, and docopt please see the crate level documentation.
For example binaries showing how
module level logging works, please see the large-example crate in examples/.
stderrlog 0.6.x supports
log >= 0.4.11stderrlog 0.5.x supports
log >= 0.4.11stderrlog 0.4.x supports
log >= 0.4.1stderrlog 0.3.x supports
log 0.3.xstderrlog 0.2.x supports
log >= 0.3.0, < 0.3.9Add this to your Cargo.toml:
[dependencies]
stderrlog = "0.4"
and this to your main():
stderrlog::new().verbosity(args.flag_v).quiet(args.flag_q).init().unwrap();
where your args struct is defined as:
struct Args {
flag_v: usize,
flag_q: bool,
...
}
Rust log implementation that logs to stderr based on verbosity specified supports macros and colors
Rust
33
193 commits
updated Jul 9, 2024
Logger that aims to provide a simple case of
env_logger that just
logs to stderr based on verbosity.
For a working example for StructOpt, clap, and docopt please see the crate level documentation.
For example binaries showing how
module level logging works, please see the large-example crate in examples/.
stderrlog 0.6.x supports
log >= 0.4.11stderrlog 0.5.x supports
log >= 0.4.11stderrlog 0.4.x supports
log >= 0.4.1stderrlog 0.3.x supports
log 0.3.xstderrlog 0.2.x supports
log >= 0.3.0, < 0.3.9Add this to your Cargo.toml:
[dependencies]
stderrlog = "0.4"
and this to your main():
stderrlog::new().verbosity(args.flag_v).quiet(args.flag_q).init().unwrap();
where your args struct is defined as:
struct Args {
flag_v: usize,
flag_q: bool,
...
}