#error-logging #log-error #error #logger #traits

unwrap_or_log

A simple crate adding two functions to all std::resut::Result to log errors using the log crate

2 unstable releases

0.2.0 Feb 26, 2024
0.1.0 Feb 22, 2024

#13 in #log-error

Download history 107/week @ 2024-02-17 159/week @ 2024-02-24 19/week @ 2024-03-02 11/week @ 2024-03-09 9/week @ 2024-03-16 26/week @ 2024-03-30 2/week @ 2024-04-06 60/week @ 2024-04-13

60 downloads per month

MIT license

5KB
78 lines

unwrap_or_log

This crate adds a function to all [std::results::Result<T,E>] where E implements std::error::Error by implementing the trait LogError for them

The trait LogError exposes a function LogError::log_error that takes a result, logs it if it's an error and returns it unmodified:


lib.rs:

unwrap_or_log

This crate adds a function to all [std::results::Result<T,E>] where E implements std::error::Error by implementing the trait LogError for them

The trait LogError exposes a function LogError::log_error that takes a result, logs it if it's an error and returns it unmodified:

Dependencies

~89KB