Log_Err
A small extension to the log crate, which provides two methods for core::result::Result<T, E>
and core::option::Option<T>
log_except
and log_unwrap
, which invoke the log::error!
macro (in case of Result::Err
/Option::None
) in addition to unwrapping/expecting the Result
/Option
.
Shorthand for:
something.map_err.expect
Example:
let mut file = create.log_expect;
# Error will be logged with the error! macro
[ERROR] Error creating file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
# Main program panic'ing with same message
thread 'main' panicked at 'Error creating file: Os { code: 2, kind: NotFound, message: "No such file or directory" }', test.rs:4:48