flatten logfilter into route

This commit is contained in:
Chris Beck
2025-12-05 23:51:05 -07:00
parent 928a1aba78
commit 4e9704def2
2 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -241,8 +241,8 @@ impl LogHandler {
continue; continue;
} }
// Check if message matches route's filter (if any) // Check if message matches route's filter
if !route.filter.as_ref().is_none_or(|f| f.matches(log_msg)) { if !route.filter.matches(log_msg) {
continue; continue;
} }
+5 -5
View File
@@ -52,10 +52,10 @@ pub struct Route {
#[serde(default = "default_alert_level")] #[serde(default = "default_alert_level")]
pub alert_level: Level, pub alert_level: Level,
/// Optional filter to match log messages for this route. /// Filter to match log messages for this route.
/// If not specified, the route matches all messages. /// If all filter fields are empty, the route matches all messages.
#[serde(default)] #[serde(flatten)]
pub filter: Option<LogFilter>, pub filter: LogFilter,
/// Optional destination override for alerts from this route. /// Optional destination override for alerts from this route.
/// If not specified, alerts go to the default admin destination. /// If not specified, alerts go to the default admin destination.
@@ -93,7 +93,7 @@ impl Default for Route {
fn default() -> Self { fn default() -> Self {
Self { Self {
alert_level: default_alert_level(), alert_level: default_alert_level(),
filter: None, filter: LogFilter::default(),
destination: None, destination: None,
limit: Vec::new(), limit: Vec::new(),
global_limit: Vec::new(), global_limit: Vec::new(),