mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
clippy, update readme
This commit is contained in:
parent
1e33ad60db
commit
42c4ebe4c1
2 changed files with 10 additions and 12 deletions
|
|
@ -15,7 +15,8 @@ logsmash ./logfile.log
|
||||||
|
|
||||||
## Log files
|
## Log files
|
||||||
|
|
||||||
Logsmash supports both loading plain log files, or zip files containing (only) the log.
|
Logsmash supports both loading plain log files, compressed log files (`.gz`, `.bz2`, `.xz` or `.zst`), or archives
|
||||||
|
containing log files (`.zip` or (compressed) `.tar`).
|
||||||
|
|
||||||
## Log sources
|
## Log sources
|
||||||
|
|
||||||
|
|
@ -99,10 +100,6 @@ Currently, the program can match against data from the following sources:
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
- [ ] More flexible log file input
|
|
||||||
- [x] Log files compressed trough gzip
|
|
||||||
- [ ] Log files compressed trough other compression methods
|
|
||||||
- [ ] Archived containing more than one file
|
|
||||||
- [ ] Data from more app version
|
- [ ] Data from more app version
|
||||||
- [ ] Support extracting app versions from a system report
|
- [ ] Support extracting app versions from a system report
|
||||||
- [ ] Add filtering to all lists
|
- [ ] Add filtering to all lists
|
||||||
|
|
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -6,7 +6,7 @@ use crate::matcher::{MatchResult, Matcher};
|
||||||
use crate::ui::run_ui;
|
use crate::ui::run_ui;
|
||||||
use base64::prelude::*;
|
use base64::prelude::*;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use indicatif::{ParallelProgressIterator};
|
use indicatif::{ParallelProgressIterator, ProgressStyle};
|
||||||
use logsmash_data::{default_apps, get_statements, SourceDefinition};
|
use logsmash_data::{default_apps, get_statements, SourceDefinition};
|
||||||
use main_error::MainResult;
|
use main_error::MainResult;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
@ -71,7 +71,10 @@ fn main() -> MainResult {
|
||||||
);
|
);
|
||||||
let matcher = Matcher::new(&statements);
|
let matcher = Matcher::new(&statements);
|
||||||
|
|
||||||
let line_count = lines.len();
|
let progress_style = ProgressStyle::with_template(
|
||||||
|
"[{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {msg} {eta}",
|
||||||
|
)
|
||||||
|
.expect("invalid progress bar style");
|
||||||
|
|
||||||
let mut results: Vec<_> = lines
|
let mut results: Vec<_> = lines
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
|
|
@ -83,14 +86,12 @@ fn main() -> MainResult {
|
||||||
parsed.map_err(|err| (index, line, err))
|
parsed.map_err(|err| (index, line, err))
|
||||||
})
|
})
|
||||||
.map(|parsed| {
|
.map(|parsed| {
|
||||||
let res = parsed.map(|parsed| {
|
parsed.map(|parsed| {
|
||||||
let log_match = matcher.match_log(&parsed);
|
let log_match = matcher.match_log(&parsed);
|
||||||
(parsed, log_match)
|
(parsed, log_match)
|
||||||
});
|
})
|
||||||
// bar.inc(1);
|
|
||||||
res
|
|
||||||
})
|
})
|
||||||
.progress_count(line_count as u64)
|
.progress_with_style(progress_style)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
results.sort_by_key(|res| match res {
|
results.sort_by_key(|res| match res {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue