flatten logfilter into route
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user