log-error

Crates.iolog-error
lib.rslog-error
version0.1.1
sourcesrc
created_at2022-06-23 14:07:39.755388
updated_at2023-03-06 12:41:02.544214
descriptionA small crate to log the error result easily
homepage
repository
max_upload_size
id611901
size5,104
metaworm (metaworm)

documentation

https://docs.rs/log-error

README

log-error

A small crate to log the error result easily

Sometimes we just want to record the error result, rather than return it to upper caller or unwrap the result with a panic, this crate will help you do it in relaxed

Example

use log_error::*;
use std::io::Error;

fn main() {
    simple_logger::SimpleLogger::new().env().init().unwrap();

    if let Some(_file) = std::fs::read("").log_warn("optional file") {
        // do something
    }

    // detailed error message
    do_something().log_error_detail("do_something");
}

fn do_something() -> Result<(), Error> {
    // ...
    Err(Error::last_os_error())
}
Commit count: 0

cargo fmt