1 unstable release
Uses old Rust 2015
0.1.0 | Nov 25, 2017 |
---|
#26 in #env-logger
Used in 2 crates
7KB
69 lines
mxo_env_logger
Another env_logger
wrapped.
Cargo.toml:
[dependencies]
mxo_env_logger = "^0.1"
log = "^0.3.8"
Code:
#[macro_use]
extern crate log;
extern crate mxo_env_logger;
use mxo_env_logger::*; // * contains StdErr(std::error::Error), so can use `e.description()` direct.
fn main() {
init();
trace!("Trace her"); // default closed.
info!("Info u");
warn!("Warning her");
error!("Error world!");
std::fs::File::open("Hentai.you").log_err(|e| error!("File open failed: {:?}", e.description()));
std::env::args().nth(1000).ok_or("No 1000 Args").log_err(|e| error!("{}", e));
}
Output:
INFO #main::mock:26: Info u
WARN #main::mock:27: Warning her
ERROR#main::mock:28: Error world!
ERROR#main:12: File open failed: "entity not found"
ERROR#main:16: No 1000 Args
Dependencies
~3.5MB
~76K SLoC