mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-04 02:24:11 +02:00
remove logging statement indirection
This commit is contained in:
parent
7dfbbddde6
commit
ea695e8460
8 changed files with 120 additions and 126 deletions
|
|
@ -41,7 +41,7 @@ pub fn match_list<'a>(app: &'a App<'a>, filter: &Filter) -> ScrollbarTable<'a> {
|
|||
.chain(
|
||||
app.matches
|
||||
.iter()
|
||||
.filter(|result| result.matches(app, filter))
|
||||
.filter(|result| result.matches(filter))
|
||||
.map(|result| log_row(result, app, "")),
|
||||
)
|
||||
.chain(unmatched),
|
||||
|
|
@ -55,11 +55,10 @@ fn log_row<'a>(result: &'a LogMatch, app: &'a App, name: &'static str) -> Row<'a
|
|||
let mut message = String::new();
|
||||
let mut paths = String::new();
|
||||
let mut lines = String::new();
|
||||
for index in match_result.iter() {
|
||||
let statement = app.log_statements.get(index).expect("invalid match index");
|
||||
for statement in match_result.iter() {
|
||||
writeln!(&mut message, "{}", statement.message()).ok();
|
||||
writeln!(&mut paths, "{}", statement.path()).ok();
|
||||
writeln!(&mut lines, "{}", statement.line).ok();
|
||||
writeln!(&mut lines, "{}", statement.line()).ok();
|
||||
}
|
||||
Row::new([
|
||||
Text::from(message),
|
||||
|
|
@ -68,7 +67,7 @@ fn log_row<'a>(result: &'a LogMatch, app: &'a App, name: &'static str) -> Row<'a
|
|||
Text::from(result.sparkline(app)),
|
||||
Text::from(result.count().to_string()),
|
||||
])
|
||||
.height(match_result.len() as u16)
|
||||
.height(match_result.count() as u16)
|
||||
} else {
|
||||
Row::new([
|
||||
Text::from(name),
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl<'a> MatchListState<'a> {
|
|||
} else {
|
||||
app.matches
|
||||
.iter()
|
||||
.filter(|log_match| log_match.matches(app, &self.filter))
|
||||
.filter(|log_match| log_match.matches(&self.filter))
|
||||
.nth(selected - 1)
|
||||
.unwrap_or(&app.unmatched)
|
||||
}
|
||||
|
|
@ -356,7 +356,7 @@ impl<'a> UiState<'a> {
|
|||
let match_row_counts = app
|
||||
.matches
|
||||
.iter()
|
||||
.filter(|m| m.matches(app, filter))
|
||||
.filter(|m| m.matches(filter))
|
||||
.map(|m| m.row_count());
|
||||
for (index, row_count) in once(1)
|
||||
.chain(match_row_counts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue