Trait logchop::OptionLogFormatter [−][src]
Augment Option
types with log methods that can print abitrary representations of wrapped
values. If the type being wrapped implements Debug
, you may be able to use OptionLogger
instead.
The callsite is responsible for defining the format strategy. The closure is only evaluated when necessary.
This trait defines methods prefixed by the log level, as well as a general one that accepts a log level parameter.
<log_level>_format(FnOnce)
prints the return value of the closure ifSome
orNone
<log_level>_format_some(FnOnce)
prints the return value of the closure ifSome
<log_level>_format_none(FnOnce)
prints the return value of the closure ifNone
Required methods
fn log_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a log message of the provided severity if Some
or None
. The message is
determined by the return value of the supplied closure.
fn log_some_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a log message of the provided severity if Some
. The message is determined by the
return value of the supplied closure.
fn log_none_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a log message of the provided severity if None
. The message is determined by the
return value of the supplied closure.
fn trace_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a trace log with the return value of the provided closure.
fn trace_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a
trace
log with the return value of the provided closure if Some
.
fn trace_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a
trace
log with the return value of the provided closure if None
.
fn debug_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a debug log with the return value of the provided closure.
fn debug_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a
debug
log with the return value of the provided closure if Some
.
fn debug_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a
debug
log with the return value of the provided closure if None
.
fn info_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a info log with the return value of the provided closure.
fn info_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a
info
log with the return value of the provided closure if Some
.
fn info_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a
info
log with the return value of the provided closure if None
.
fn warn_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a warn log with the return value of the provided closure.
fn warn_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a
warn
log with the return value of the provided closure if Some
.
fn warn_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a
warn
log with the return value of the provided closure if None
.
fn error_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
Output a error log with the return value of the provided closure.
fn error_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
Output a
error
log with the return value of the provided closure if Some
.
fn error_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
Output a
error
log with the return value of the provided closure if None
.
Implementations on Foreign Types
impl<T> OptionLogFormatter<T> for Option<T>
[src]
fn log_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn log_some_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn log_none_format<F>(self, level: Level, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
fn trace_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn trace_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn trace_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
fn debug_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn debug_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn debug_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
fn info_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn info_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn info_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
fn warn_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn warn_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn warn_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,
fn error_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&Option<T>) -> String,
[src]
F: FnOnce(&Option<T>) -> String,
fn error_some_format<F>(self, f: F) -> Option<T> where
F: FnOnce(&T) -> String,
[src]
F: FnOnce(&T) -> String,
fn error_none_format<F>(self, f: F) -> Option<T> where
F: FnOnce() -> String,
[src]
F: FnOnce() -> String,