From 4e9704def2ce050d969fe3f6149985bfbda21df9 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Fri, 5 Dec 2025 23:51:05 -0700 Subject: [PATCH] flatten logfilter into route --- signal-gateway/src/gateway/log_handler.rs | 4 ++-- signal-gateway/src/gateway/route.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/signal-gateway/src/gateway/log_handler.rs b/signal-gateway/src/gateway/log_handler.rs index dbfc258..769e308 100644 --- a/signal-gateway/src/gateway/log_handler.rs +++ b/signal-gateway/src/gateway/log_handler.rs @@ -241,8 +241,8 @@ impl LogHandler { continue; } - // Check if message matches route's filter (if any) - if !route.filter.as_ref().is_none_or(|f| f.matches(log_msg)) { + // Check if message matches route's filter + if !route.filter.matches(log_msg) { continue; } diff --git a/signal-gateway/src/gateway/route.rs b/signal-gateway/src/gateway/route.rs index 049786d..b1b0dab 100644 --- a/signal-gateway/src/gateway/route.rs +++ b/signal-gateway/src/gateway/route.rs @@ -52,10 +52,10 @@ pub struct Route { #[serde(default = "default_alert_level")] pub alert_level: Level, - /// Optional filter to match log messages for this route. - /// If not specified, the route matches all messages. - #[serde(default)] - pub filter: Option, + /// Filter to match log messages for this route. + /// If all filter fields are empty, the route matches all messages. + #[serde(flatten)] + pub filter: LogFilter, /// Optional destination override for alerts from this route. /// If not specified, alerts go to the default admin destination. @@ -93,7 +93,7 @@ impl Default for Route { fn default() -> Self { Self { alert_level: default_alert_level(), - filter: None, + filter: LogFilter::default(), destination: None, limit: Vec::new(), global_limit: Vec::new(),