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§
Sourcefn log_err(self, level: Level) -> Self
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§
Sourcefn err_log(self) -> Selfwhere
Self: Sized,
fn err_log(self) -> Selfwhere
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".