log-error 0.1.2

A small crate to log the error result easily
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 9 items with examples
  • Size
  • Source code size: 13.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 775.31 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • metaworm

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())
}