rename JournalPriority::as_str to as_journald_str
This commit is contained in:
parent
3e388d2d46
commit
66a3c2409c
2 changed files with 8 additions and 4 deletions
|
|
@ -859,7 +859,7 @@ pub async fn dispatch_host_journal(agent: &str, args: HostJournalArgs<'_>) -> Re
|
|||
hive_priv_sock::JournalQuery {
|
||||
lines: n,
|
||||
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(),
|
||||
since: since.clone(),
|
||||
until: until.clone(),
|
||||
|
|
@ -890,7 +890,7 @@ pub async fn dispatch_host_journal(agent: &str, args: HostJournalArgs<'_>) -> Re
|
|||
}
|
||||
if let Some(p) = priority {
|
||||
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 {
|
||||
args.push(format!("--grep={g}"));
|
||||
|
|
|
|||
|
|
@ -774,9 +774,13 @@ pub enum 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]
|
||||
pub fn as_str(self) -> &'static str {
|
||||
pub fn as_journald_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::Emerg => "emerg",
|
||||
Self::Alert => "alert",
|
||||
|
|
|
|||
Loading…
Reference in a new issue