//! Journal-priority encoding for `GetHostJournal` (`read_host_journal` //! capability). One small enum, own topic module rather than a //! catch-all — see `hive-sh4re/README.md`'s module list. use serde::{Deserialize, Serialize}; /// Syslog priority levels for `GetHostJournal`. Serialised as lowercase /// strings matching journalctl `-p` accepted values. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, schemars::JsonSchema)] #[serde(rename_all = "lowercase")] pub enum JournalPriority { Emerg, Alert, Crit, Err, Warning, Notice, Info, Debug, } impl JournalPriority { /// Returns the lowercase string journalctl expects for `-p`. Named /// `as_journald_str` (not `as_str`) because this is a specific /// external-tool encoding, not the enum's general wire/db string — /// distinct call sites shouldn't reach for this by accident when they /// actually want the serde wire representation. #[must_use] pub fn as_journald_str(self) -> &'static str { match self { Self::Emerg => "emerg", Self::Alert => "alert", Self::Crit => "crit", Self::Err => "err", Self::Warning => "warning", Self::Notice => "notice", Self::Info => "info", Self::Debug => "debug", } } }