A Rust's library that using macro to write io::stderr() for error or io::stdout() for log optional.
Usage
Cargo.toml
[]
= "0.5.0"
or
[]
= { = "https://github.com/biluohc/stderr", = "master", = "0.5.0"}
Explain
About stderr
Usage as same as print!/println!.
err!/errln!: Panics if writing toio::stdout()fails.errst!/errstln!: Do nothing if writing toio::stdout()fails(silent->st).
About stderr::loger::Loger
Avoid to note or use a bunch of print!()/println!() non-stop.
debug!()/debugln!() print message while args conntains -log or --log and debug follows it,or environment variable 'LOG' == debug.
Usage as same as err!/errln! and errst!/errstln!.
Example for bash:
If you neend to use debug!()/debugln!():
You must use Loger::init() before use the macro on the current process.
if you need to contrl it:
You can use Loger::set(bool) to replace Loger::init(),
Loger::arg(): Get args's -log/--log==debug value(bool),
Loger::var(): Get environment variable's LOG==debug value(bool).
Example
extern crate stderr;