Trait logchop::OptionLogger[][src]

pub trait OptionLogger<T> {
    fn log(self, level: Level, message: &str) -> Option<T>;
fn log_some(self, level: Level, message: &str) -> Option<T>;
fn log_none(self, level: Level, message: &str) -> Option<T>;
fn trace(self, message: &str) -> Option<T>;
fn trace_some(self, message: &str) -> Option<T>;
fn trace_none(self, message: &str) -> Option<T>;
fn debug(self, message: &str) -> Option<T>;
fn debug_some(self, message: &str) -> Option<T>;
fn debug_none(self, message: &str) -> Option<T>;
fn info(self, message: &str) -> Option<T>;
fn info_some(self, message: &str) -> Option<T>;
fn info_none(self, message: &str) -> Option<T>;
fn warn(self, message: &str) -> Option<T>;
fn warn_some(self, message: &str) -> Option<T>;
fn warn_none(self, message: &str) -> Option<T>;
fn error(self, message: &str) -> Option<T>;
fn error_some(self, message: &str) -> Option<T>;
fn error_none(self, message: &str) -> Option<T>; }

Augment Option types with log methods that can print Debug representations of wrapped values. If the type being logged does not implement Debug, use OptionLogFormatter 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 Some, or prints the message if None
  • <log_level>_some(message) appends the wrapped value to the message if Some
  • <log_level>_none() outputs the message if None

Required methods

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

Output a log message of the provided severity if Some or None. If Some, the wrapped value will be appended.

fn log_some(self, level: Level, message: &str) -> Option<T>[src]

Output a log message of the provided severity if Some, with the wrapped value appended.

fn log_none(self, level: Level, message: &str) -> Option<T>[src]

Output a log message of the provided severity if None.

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

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

fn trace_some(self, message: &str) -> Option<T>[src]

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

fn trace_none(self, message: &str) -> Option<T>[src]

Output a trace log with the given message if None.

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

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

fn debug_some(self, message: &str) -> Option<T>[src]

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

fn debug_none(self, message: &str) -> Option<T>[src]

Output a debug log with the given message if None.

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

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

fn info_some(self, message: &str) -> Option<T>[src]

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

fn info_none(self, message: &str) -> Option<T>[src]

Output a info log with the given message if None.

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

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

fn warn_some(self, message: &str) -> Option<T>[src]

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

fn warn_none(self, message: &str) -> Option<T>[src]

Output a warn log with the given message if None.

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

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

fn error_some(self, message: &str) -> Option<T>[src]

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

fn error_none(self, message: &str) -> Option<T>[src]

Output a error log with the given message if None.

Loading content...

Implementations on Foreign Types

impl<T> OptionLogger<T> for Option<T> where
    T: Debug
[src]

Loading content...

Implementors

Loading content...