Skip to main content

LogErr

Trait LogErr 

Source
pub trait LogErr<T, E: Display> {
    // Required method
    fn err_log(self, level: Level) -> Self;

    // Provided method
    fn log_err(self) -> Self
       where Self: Sized { ... }
}
Expand description

Logs display-formatted errors without changing their result.

Successful values pass through without producing a record. Errors remain available to the caller after being logged.

Required Methods§

Source

fn err_log(self, level: Level) -> Self

Logs an error at level and returns the original result.

The error is formatted with Display. Successful values produce no log record.

Provided Methods§

Source

fn log_err(self) -> Self
where Self: Sized,

Logs an error at the error tracing level.

LogErr::err_log supplies this convenience form with Level::ERROR. The original result is returned after inspection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, E: Display> LogErr<T, E> for Result<T, E>