pub fn result_or_log<L, T, E, M>(
    logger: &mut L, 
    severity: Severity, 
    msg: M, 
    res: Result<T, E>) -> Option<T>
    where E: Error + Debug,
          L: Logger,
          M: Display {
    match res {
        Err(err) => {
            log!(logger, severity, "{} ({})", msg, err);
            None
        },
        Ok(res)  => Some(res)
    }
}
/// Unwrap a given result or log an error with a given severity and return None.
Unwrap a given result or log an error with a given severity and return None.
Unwrap a given result or log an error with a given severity and return None .
pub fn result_or_log<L, T, E, M>(
    logger: &mut L, 
    severity: Severity, 
    msg: M, 
    res: Result<T, E>) -> Option<T>
    where E: Error + Debug,
          L: Logger,
          M: Display {
    match res {
        Err(err) => {
            log!(logger, severity, "{} ({})", msg, err);
            None
        },
        Ok(res)  => Some(res)
    }
}
pub fn result_or_log < L , T , E , M > ( logger : & mut L , severity : Severity , msg : M , res : Result < T , E > ) -> Option < T > where E : Error + Debug , L : Logger , M : Display { match res { Err ( err ) => { log ! ( logger severity " " msg err ) ; None } , Ok ( res ) => Some ( res ) } }
Unwrap a given result or log an error with a given severity and return None.
Unwrap a given result or log an error with a given severity and return None .
logger
&mut L
severity
Severity
msg
M
res
Result<T, E>
logger
&mut L
severity
Severity
msg
M
res
Result<T, E>