mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
make log parsing more reliable
This commit is contained in:
parent
174c6d541c
commit
7b8e8ec6cb
3 changed files with 41 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use crate::app::App;
|
||||
use crate::logline::{FullException, FullLogLine, LogLine, Trace};
|
||||
use crate::parse_line_full;
|
||||
use crate::ui::style::{TABLE_HEADER_STYLE, TIME_FORMAT};
|
||||
use crate::ui::table::{ScrollbarTable, ScrollbarTableState};
|
||||
use ratatui::prelude::*;
|
||||
|
|
@ -9,7 +10,7 @@ use time::format_description::well_known::Iso8601;
|
|||
|
||||
pub fn single_log(app: &App, line: &LogLine) -> SingleLog {
|
||||
let raw_line = app.get_line(line.index).unwrap();
|
||||
let line: FullLogLine = serde_json::from_str(raw_line).unwrap();
|
||||
let line = parse_line_full(raw_line).unwrap();
|
||||
SingleLog { line }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::app::{App, LogMatch};
|
||||
use crate::copy_osc;
|
||||
use crate::logline::{FullLogLine, LogLine};
|
||||
use crate::ui::table::ScrollbarTableState;
|
||||
use crate::{copy_osc, parse_line_full};
|
||||
use derive_more::From;
|
||||
use ratatui::widgets::TableState;
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ impl<'a> UiState<'a> {
|
|||
let line = state.lines[selected];
|
||||
let log = &app.lines[line];
|
||||
let raw_line = app.get_line(log.index).unwrap();
|
||||
let full_line: FullLogLine = serde_json::from_str(raw_line).unwrap();
|
||||
let full_line = parse_line_full(raw_line).unwrap();
|
||||
let trace_len = if let Some(exception) = &full_line.exception {
|
||||
exception.stack().map(|e| 1 + e.trace.len()).sum()
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue