This commit is contained in:
Robin Appelman 2024-09-12 19:41:11 +02:00
commit bce2ba3bf5
2 changed files with 15 additions and 24 deletions

View file

@ -124,7 +124,7 @@ impl<'a> LogLine<'a> {
}
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Hash)]
#[serde(rename_all = "PascalCase")]
pub struct Exception<'a> {
pub message: Cow<'a, str>,
@ -133,15 +133,6 @@ pub struct Exception<'a> {
pub line: usize,
}
impl Hash for Exception<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.message.hash(state);
self.exception.hash(state);
self.file.hash(state);
self.line.hash(state);
}
}
#[derive(Deserialize, Clone)]
pub struct FullLogLine {
#[serde(rename = "reqId")]

View file

@ -97,20 +97,20 @@ impl Matcher {
break;
}
if !log_match.pattern.is_empty() {
if match_single(log_match.pattern, log.message.as_ref()) {
best_length = log_match.pattern_len();
best_match = Some(match best_match {
Some(MatchResult::Single(res)) => {
MatchResult::List(vec![res, log_match.index])
}
Some(MatchResult::List(mut list)) => {
list.push(log_match.index);
MatchResult::List(list)
}
None => MatchResult::Single(log_match.index),
});
}
if !log_match.pattern.is_empty()
&& match_single(log_match.pattern, log.message.as_ref())
{
best_length = log_match.pattern_len();
best_match = Some(match best_match {
Some(MatchResult::Single(res)) => {
MatchResult::List(vec![res, log_match.index])
}
Some(MatchResult::List(mut list)) => {
list.push(log_match.index);
MatchResult::List(list)
}
None => MatchResult::Single(log_match.index),
});
}
}
}