mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
generate more data logic
This commit is contained in:
parent
b666e47a6e
commit
5e09bb8ea6
16 changed files with 8867 additions and 8758 deletions
|
|
@ -17,15 +17,6 @@ pub struct LogLine {
|
|||
}
|
||||
|
||||
impl LogLine {
|
||||
pub fn major_version(&self) -> Option<u32> {
|
||||
let major = self
|
||||
.version
|
||||
.split_once('.')
|
||||
.map(|(major, _)| major)
|
||||
.unwrap_or(self.version.as_str());
|
||||
major.parse().ok()
|
||||
}
|
||||
|
||||
pub fn index(&self) -> u64 {
|
||||
let mut hasher = AHasher::default();
|
||||
self.message.hash(&mut hasher);
|
||||
|
|
|
|||
12
src/main.rs
12
src/main.rs
|
|
@ -5,8 +5,9 @@ use crate::logline::LogLine;
|
|||
use crate::matcher::{MatchResult, Matcher};
|
||||
use crate::ui::run_ui;
|
||||
use clap::Parser;
|
||||
use logsmash_data::{get_statements, MAX_VERSION};
|
||||
use logsmash_data::{default_apps, get_statements, SourceDefinition};
|
||||
use main_error::MainResult;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::once;
|
||||
|
||||
|
|
@ -44,7 +45,14 @@ fn main() -> MainResult {
|
|||
}
|
||||
};
|
||||
|
||||
let statements = get_statements(first_parsed.major_version().unwrap_or(MAX_VERSION));
|
||||
let server_version = first_parsed.version;
|
||||
let statements = get_statements(
|
||||
once(SourceDefinition {
|
||||
name: "server",
|
||||
version: Cow::Owned(server_version.to_string()),
|
||||
})
|
||||
.chain(default_apps()),
|
||||
);
|
||||
let matcher = Matcher::new(&statements);
|
||||
|
||||
let lines = once(first).chain(lines);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue