mxo_env_logger

Crates.iomxo_env_logger
lib.rsmxo_env_logger
version0.1.0
sourcesrc
created_at2017-11-25 15:18:17.704788
updated_at2017-11-25 15:18:17.704788
descriptionAnother env_logger wrapped.
homepage
repositoryhttps://github.com/biluohc/mxo_env_logger
max_upload_size
id40499
size7,736
wspsxing (biluohc)

documentation

https://docs.rs/mxo_env_logger

README

Build status Latest version All downloads Downloads of latest version Documentation

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
Commit count: 0

cargo fmt