mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
cleanup
This commit is contained in:
parent
b67cc99dbe
commit
e27a964457
1 changed files with 0 additions and 32 deletions
|
|
@ -2,7 +2,6 @@ use crate::logline::LogLine;
|
|||
use itertools::Either;
|
||||
use logsmash_data::{LogLevel, LoggingStatement, StatementList};
|
||||
use regex::Regex;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::iter::once;
|
||||
|
||||
pub struct LogMatch {
|
||||
|
|
@ -106,37 +105,6 @@ impl MatchResult {
|
|||
}
|
||||
}
|
||||
|
||||
struct MatchResultDisplay<'a> {
|
||||
log_statements: &'a StatementList,
|
||||
result: &'a MatchResult,
|
||||
}
|
||||
|
||||
impl Display for MatchResultDisplay<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self.result {
|
||||
MatchResult::Single(index) => {
|
||||
if let Some(statement) = self.log_statements.get(*index) {
|
||||
write!(f, "{statement}")
|
||||
} else {
|
||||
write!(f, "«unknown statement»")
|
||||
}
|
||||
}
|
||||
MatchResult::List(list) => {
|
||||
// todo: max length
|
||||
for (i, index) in list.iter().enumerate() {
|
||||
if let Some(statement) = self.log_statements.get(*index) {
|
||||
if i > 0 {
|
||||
write!(f, " or ")?;
|
||||
}
|
||||
writeln!(f, "{statement}")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_matcher() {
|
||||
use crate::logline::Exception;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue