#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[repr(u8)]
pub enum Severity
{
Emergency = 0,
Alert = 1,
Critical = 2,
Error = 3,
Warning = 4,
Notice = 5,
Informational = 6,
Debug = 7,
}
impl Default for Severity
{
#[inline(always)]
fn default() -> Self
{
use self::Severity::*;
if cfg!(debug_assertions)
{
Debug
}
else
{
Warning
}
}
}
impl Severity
{
#[inline(always)]
pub fn log_upto(self) -> i32
{
(1 << ((self as u8 as i32) + 1)) - 1
}
}