mahogany 0.1.0

[BETA] Logging framework for Rust
Documentation
use crate::{LogLevel, Loggable, Logger};

#[derive(Clone)]
pub enum StandardLogLevel {
    Debug,
    Info,
    Warning,
    Error,
}
impl LogLevel for StandardLogLevel {
    fn level_string(&self) -> &'static str {
        match self {
            StandardLogLevel::Debug => "DEBUG",
            StandardLogLevel::Info => "INFO",
            StandardLogLevel::Warning => "WARNING",
            StandardLogLevel::Error => "ERROR",
        }
    }
}

pub trait StandardLogLevelLogger {
    fn debug(&self, message: &dyn Loggable);
    fn info(&self, message: &dyn Loggable);
    fn warning(&self, message: &dyn Loggable);
    fn error(&self, message: &dyn Loggable);
}
impl StandardLogLevelLogger for Logger<StandardLogLevel> {
    fn debug(&self, message: &dyn Loggable) {
        self.log(StandardLogLevel::Debug, message);
    }

    fn info(&self, message: &dyn Loggable) {
        self.log(StandardLogLevel::Info, message);
    }

    fn warning(&self, message: &dyn Loggable) {
        self.log(StandardLogLevel::Warning, message);
    }

    fn error(&self, message: &dyn Loggable) {
        self.log(StandardLogLevel::Error, message);
    }
}