Trait logchop::ResultLogger[][src]

pub trait ResultLogger<T, E> {
    fn log(self, level: Level, message: &str) -> Result<T, E>;
fn log_ok(self, level: Level, message: &str) -> Result<T, E>;
fn log_err(self, level: Level, message: &str) -> Result<T, E>;
fn trace(self, message: &str) -> Result<T, E>;
fn trace_ok(self, message: &str) -> Result<T, E>;
fn trace_err(self, message: &str) -> Result<T, E>;
fn debug(self, message: &str) -> Result<T, E>;
fn debug_ok(self, message: &str) -> Result<T, E>;
fn debug_err(self, message: &str) -> Result<T, E>;
fn info(self, message: &str) -> Result<T, E>;
fn info_ok(self, message: &str) -> Result<T, E>;
fn info_err(self, message: &str) -> Result<T, E>;
fn warn(self, message: &str) -> Result<T, E>;
fn warn_ok(self, message: &str) -> Result<T, E>;
fn warn_err(self, message: &str) -> Result<T, E>;
fn error(self, message: &str) -> Result<T, E>;
fn error_ok(self, message: &str) -> Result<T, E>;
fn error_err(self, message: &str) -> Result<T, E>; }

Augment Result types with log methods that can print debug representations of wrapped values. If the wrapped Ok or Err types do not implement Debug, use ResultLogFormatter instead.

This trait defines methods prefixed by the log level, as well as a general one that accepts a log level parameter.

  • <log_level>(message) appends the option to the message if Ok or Err
  • <log_level>_ok(message) appends the wrapped value to the message if Ok
  • <log_level>_err(message) appends the wrapped value to the message if Err

Required methods

fn log(self, level: Level, message: &str) -> Result<T, E>[src]

Output a log message of the provided severity if Ok or Err. The wrapped value will be appended.

fn log_ok(self, level: Level, message: &str) -> Result<T, E>[src]

Output a log message of the provided severity if Ok. The wrapped value will be appended.

fn log_err(self, level: Level, message: &str) -> Result<T, E>[src]

Output a log message of the provided severity if Err. The wrapped value will be appended.

fn trace(self, message: &str) -> Result<T, E>[src]

Output a trace log with the given message. This will append the wrapped value.

fn trace_ok(self, message: &str) -> Result<T, E>[src]

Output a trace log with the given message if Ok, appending the wrapped value.

fn trace_err(self, message: &str) -> Result<T, E>[src]

Output a trace log with the given message if Err, appending the wrapped value.

fn debug(self, message: &str) -> Result<T, E>[src]

Output a debug log with the given message. This will append the wrapped value.

fn debug_ok(self, message: &str) -> Result<T, E>[src]

Output a debug log with the given message if Ok, appending the wrapped value.

fn debug_err(self, message: &str) -> Result<T, E>[src]

Output a debug log with the given message if Err, appending the wrapped value.

fn info(self, message: &str) -> Result<T, E>[src]

Output a info log with the given message. This will append the wrapped value.

fn info_ok(self, message: &str) -> Result<T, E>[src]

Output a info log with the given message if Ok, appending the wrapped value.

fn info_err(self, message: &str) -> Result<T, E>[src]

Output a info log with the given message if Err, appending the wrapped value.

fn warn(self, message: &str) -> Result<T, E>[src]

Output a warn log with the given message. This will append the wrapped value.

fn warn_ok(self, message: &str) -> Result<T, E>[src]

Output a warn log with the given message if Ok, appending the wrapped value.

fn warn_err(self, message: &str) -> Result<T, E>[src]

Output a warn log with the given message if Err, appending the wrapped value.

fn error(self, message: &str) -> Result<T, E>[src]

Output a error log with the given message. This will append the wrapped value.

fn error_ok(self, message: &str) -> Result<T, E>[src]

Output a error log with the given message if Ok, appending the wrapped value.

fn error_err(self, message: &str) -> Result<T, E>[src]

Output a error log with the given message if Err, appending the wrapped value.

Loading content...

Implementations on Foreign Types

impl<T, E> ResultLogger<T, E> for Result<T, E> where
    T: Debug,
    E: Debug
[src]

Loading content...

Implementors

Loading content...