mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
support reading log.gz files
This commit is contained in:
parent
6213aff07e
commit
4737a0db3c
4 changed files with 13 additions and 3 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
|
@ -404,9 +404,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
|||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.30"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
||||
checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
|
|
@ -574,6 +574,7 @@ dependencies = [
|
|||
"base64",
|
||||
"clap",
|
||||
"derive_more",
|
||||
"flate2",
|
||||
"hdrhistogram",
|
||||
"itertools",
|
||||
"log",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ log = "0.4.22"
|
|||
clap = { version = "=4.1.3", features = ["derive"] }
|
||||
logsmash-data = { version = "0.1.0", path = "./data" }
|
||||
zip = "2.1.5"
|
||||
flate2 = "1.0.31"
|
||||
itertools = "0.13.0"
|
||||
ratatui = "0.27.0"
|
||||
tinystr = { version = "0.7.6", features = ["serde"] }
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ Currently, the program can match against data from the following sources:
|
|||
## Roadmap
|
||||
|
||||
- [ ] More flexible log file input
|
||||
- [ ] Log files compressed trough gzip, xz, etc
|
||||
- [x] Log files compressed trough gzip
|
||||
- [ ] Log files compressed trough other compression methods
|
||||
- [ ] Archived containing more than one file
|
||||
- [ ] Data from more app version
|
||||
- [ ] Support extracting app versions from a system report
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::error::ReadError;
|
||||
use flate2::read::GzDecoder;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use zip::ZipArchive;
|
||||
|
|
@ -22,6 +23,12 @@ impl LogFile {
|
|||
let mut content = String::with_capacity(log.size() as usize);
|
||||
log.read_to_string(&mut content)?;
|
||||
|
||||
Ok(LogFile { content })
|
||||
} else if path.ends_with(".gz") {
|
||||
let mut decoder = GzDecoder::new(file);
|
||||
let mut content = String::new();
|
||||
decoder.read_to_string(&mut content)?;
|
||||
|
||||
Ok(LogFile { content })
|
||||
} else {
|
||||
let mut content = String::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue