Expand description
§stderr
A library that using macro to write to io::stderr()
like print!()/println!()
for rust.
§Usage
On Cargo.toml:
[dependencies]
stderr = "0.8.0"
§About stderr
Usage as same as print!/println!
.
err!
/errln!
: Panics if writing toio::stderr()
fails.errst!
/errstln!
: Do nothing if writing toio::stderr()
fails(silent->st).
§Example
#[macro_use]
extern crate stderr;
fn main() {
println!("err!/errln!/errst!/errstln!()@stderr !");
let vec = vec![1, 2, 3, 4, 5];
let s = std::env::args().nth(0).unwrap();
err!("err!(expr\\n)\n");
err!("err!(String: vec![1, 2, 3, 4, 5])\n{}: {:?}", s, vec);
errln!();
errln!("errln!(expr)");
println!();
errst!("errst!(expr\\n)\n");
errst!("errst!(String: vec![1, 2, 3, 4, 5])\n{}: {:?}", s, vec);
errstln!();
errstln!("errstln!(expr)");
}
§If you only need errxxx
and don’t want be polluted by other macros, you can:
- use v0.3.0(The part has been stable since this version)
On Cargo.toml:
[dependencies]
stderr = "0.3.0"
§Or
- Only import you need by
macro_use
On Code:
#[macro_use(err,errln,errst,errstln)]
extern crate stderr;
§About stderr::StaticMut
StaticMut
: Internal variability for Lazystatic
Modules§
- log
log module
Macros§
- db
- dbln
- dbst
- dbstln
- debug
- Equal to
db!()
- debugln
- Equal to
dbln!()
- err
print!()
for stderr- errln
println!()
for stderr- error
- errorln
- errst
print!()
withoutunwrap()
for stderr- errstln
println!()
withoutunwrap()
for stderr- fatal
- write the
LogMsg
tostderr
andpanic
with theLogMsg
- fataln
- write the
LogMsg
tostderr
andpanic
with theLogMsg
- info
- infoln
- init
Deprecated - Equal to
logger_init!()
- loc
- Get location(
module_path:line:column
) - logger_
init - Equal to
Logger::init(pkg!())
- pkg
- Get
crate
name - warn
- warnln
Structs§
- Static
Mut Internal variability
forLazystatic