bflog 0.1.0

Very tiny logging framework made for microservices.
Documentation
#[derive(Clone)]
pub enum Severity {
  Debug,
  Info,
  Warn,
  Error,
}

impl Severity {
  pub fn from_str(string: impl AsRef<str>) -> Option<Severity> {
    match string.as_ref() {
      "debug" => Some(Severity::Debug),
      "info" => Some(Severity::Info),
      "warn" => Some(Severity::Warn),
      "error" => Some(Severity::Error),
      _ => None,
    }
  }

  pub fn to_level(&self) -> i32 {
    match self {
      Severity::Debug => -1,
      Severity::Info => 0,
      Severity::Warn => 1,
      Severity::Error => 2,
    }
  }

  pub fn to_str(&self) -> &'static str {
    match self {
      Severity::Debug => "debug",
      Severity::Info => "info",
      Severity::Warn => "warn",
      Severity::Error => "error",
    }
  }

  pub fn to_aligned_str(&self) -> &'static str {
    match self {
      Severity::Debug => "DEBG",
      Severity::Info => "INFO",
      Severity::Warn => "WARN",
      Severity::Error => "ERRO",
    }
  }

  pub fn to_icon(&self) -> &'static str {
    match self {
      Severity::Debug => "",
      Severity::Info => "",
      Severity::Warn => "",
      Severity::Error => "",
    }
  }
}

impl Default for Severity {
  fn default() -> Severity {
    Severity::Info
  }
}