use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum LogLevel { Error, Warn, Info, Debug, Trace, } impl LogLevel { pub fn as_tracing_level(self) -> tracing::Level { match self { Self::Error => tracing::Level::ERROR, Self::Warn => tracing::Level::WARN, Self::Info => tracing::Level::INFO, Self::Debug => tracing::Level::DEBUG, Self::Trace => tracing::Level::TRACE, } } pub fn is_debug_or_trace(self) -> bool { matches!(self, Self::Debug | Self::Trace) } }