Skip to main content

ErrLog

Trait ErrLog 

Source
pub trait ErrLog<T, E>
where E: Display,
{ // Required method fn log_err(self, level: Level) -> Self; // Provided method fn err_log(self) -> Self where Self: Sized { ... } }
Expand description

Logs display-formatted errors while preserving their result.

Successful values pass through without producing a log record. Error values are inspected at the requested tracing level and remain unchanged.

Required Methods§

Source

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

Logs an error at level and returns the original result.

The error is formatted with fmt::Display. An Ok value produces no record and is returned unchanged.

Provided Methods§

Source

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

Logs an error at the error tracing level.

ErrLog::log_err 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> ErrLog<T, E> for Result<T, E>
where E: Display,