rename JournalPriority::as_str to as_journald_str

This commit is contained in:
damocles 2026-08-10 16:19:40 +02:00
commit 66a3c2409c
2 changed files with 8 additions and 4 deletions

View file

@ -859,7 +859,7 @@ pub async fn dispatch_host_journal(agent: &str, args: HostJournalArgs<'_>) -> Re
hive_priv_sock::JournalQuery { hive_priv_sock::JournalQuery {
lines: n, lines: n,
unit: unit.clone(), unit: unit.clone(),
priority: priority.as_ref().map(|p| p.as_str().to_owned()), priority: priority.as_ref().map(|p| p.as_journald_str().to_owned()),
grep: grep.clone(), grep: grep.clone(),
since: since.clone(), since: since.clone(),
until: until.clone(), until: until.clone(),
@ -890,7 +890,7 @@ pub async fn dispatch_host_journal(agent: &str, args: HostJournalArgs<'_>) -> Re
} }
if let Some(p) = priority { if let Some(p) = priority {
args.push("-p".to_owned()); args.push("-p".to_owned());
args.push(p.as_str().to_owned()); args.push(p.as_journald_str().to_owned());
} }
if let Some(g) = grep { if let Some(g) = grep {
args.push(format!("--grep={g}")); args.push(format!("--grep={g}"));

View file

@ -774,9 +774,13 @@ pub enum JournalPriority {
} }
impl JournalPriority { impl JournalPriority {
/// Returns the lowercase string journalctl expects for `-p`. /// 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] #[must_use]
pub fn as_str(self) -> &'static str { pub fn as_journald_str(self) -> &'static str {
match self { match self {
Self::Emerg => "emerg", Self::Emerg => "emerg",
Self::Alert => "alert", Self::Alert => "alert",