mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
linenumber
This commit is contained in:
parent
efcb86d2cf
commit
f7ed810253
6 changed files with 23 additions and 17 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use crate::app::Filter;
|
||||
use crate::logfile::LogIndex;
|
||||
use ahash::AHasher;
|
||||
use derive_more::{Display, From};
|
||||
use logsmash_data::LogLevel;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
|
|
@ -164,13 +165,18 @@ impl<'a> LogLine<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Default, Deserialize, Debug, Copy, Clone, Hash, Display, From, PartialEq, Eq, Ord, PartialOrd,
|
||||
)]
|
||||
pub struct LineNumber(usize);
|
||||
|
||||
#[derive(Deserialize, Debug, Hash, Clone)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct Exception<'a> {
|
||||
pub message: Cow<'a, str>,
|
||||
pub exception: Cow<'a, str>,
|
||||
pub file: Cow<'a, str>,
|
||||
pub line: usize,
|
||||
pub line: LineNumber,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
|
|
@ -203,7 +209,7 @@ pub struct FullException {
|
|||
pub code: ExceptionCode,
|
||||
pub trace: Vec<Trace>,
|
||||
pub file: String,
|
||||
pub line: usize,
|
||||
pub line: LineNumber,
|
||||
pub previous: Option<Box<FullException>>,
|
||||
}
|
||||
|
||||
|
|
@ -228,13 +234,10 @@ impl FullException {
|
|||
pub struct Trace {
|
||||
#[serde(default)]
|
||||
pub file: String,
|
||||
#[serde(default)]
|
||||
pub line: usize,
|
||||
#[serde(default)]
|
||||
pub line: LineNumber,
|
||||
pub function: String,
|
||||
#[serde(default)]
|
||||
pub class: String,
|
||||
#[serde(default, rename = "type")]
|
||||
#[serde(rename = "type")]
|
||||
pub ty: Option<TinyAsciiStr<4>>,
|
||||
#[serde(default)]
|
||||
pub args: Vec<Value>,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::logfile::archive::{Archive, ArchiveEntry, TarArchive, ZipArchive};
|
|||
use bzip2_rs::DecoderReader;
|
||||
use dialoguer::Select;
|
||||
use flate2::read::GzDecoder;
|
||||
pub use logline::LogLine;
|
||||
pub use logline::{LineNumber, LogLine};
|
||||
use ruzstd::decoding::StreamingDecoder;
|
||||
use serde::Deserialize;
|
||||
use std::io::{Cursor, Read, Seek};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::logfile::logline::{Exception, LogLine};
|
||||
use crate::logfile::LineNumber;
|
||||
use itertools::Either;
|
||||
use logsmash_data::{LogLevel, LoggingStatement, StatementList};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
|
@ -11,7 +12,7 @@ pub struct LogMatch {
|
|||
pattern: &'static str,
|
||||
exception: Option<&'static str>,
|
||||
path: &'static str,
|
||||
line: usize,
|
||||
line: LineNumber,
|
||||
index: usize,
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ impl LogMatch {
|
|||
},
|
||||
exception: statement.exception,
|
||||
path: statement.path,
|
||||
line: statement.line,
|
||||
line: statement.line.into(),
|
||||
index,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,12 +142,7 @@ fn trace_line(trace: &Trace, path_prefix_length: usize) -> Row {
|
|||
.get(path_prefix_length..)
|
||||
.unwrap_or_default(),
|
||||
),
|
||||
Text::from(if trace.line > 0 {
|
||||
trace.line.to_string()
|
||||
} else {
|
||||
String::new()
|
||||
})
|
||||
.alignment(Alignment::Right),
|
||||
Text::from(trace.line.to_string()).alignment(Alignment::Right),
|
||||
Text::from(trace.function().to_string()),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue