binocular/preview/structured_log/
types.rs1#[derive(Clone, Debug)]
2pub enum LogFormat {
3 Jsonl,
4 Logfmt,
5}
6
7#[derive(Clone, Debug)]
8pub struct LogEntry {
9 pub fields: Vec<(String, String)>,
10 pub raw: String,
11}
12
13#[derive(Clone, Debug)]
14pub struct StructuredLog {
15 pub entries: Vec<LogEntry>,
16 pub total_lines: usize,
17 pub all_fields: Vec<String>,
18 pub format: LogFormat,
19}
20
21#[derive(Clone, Debug)]
22pub struct ColumnConfig {
23 pub field: String,
24 pub width: usize,
25}
26
27#[derive(Clone, Debug)]
28pub struct ColModal {
29 pub cursor: usize,
30 pub checked: Vec<bool>,
31 pub scroll: usize,
32}
33
34#[derive(Clone, Debug, Default)]
35pub struct LogFilterState {
36 pub input: String,
37 pub filters: Vec<LogFilter>,
38 pub input_active: bool,
39 pub cursor: usize,
40 pub scroll: usize,
41 pub visible_cols: Vec<ColumnConfig>,
42 pub selected_col: usize,
43 pub col_scroll: usize,
44 pub col_modal: Option<ColModal>,
45 pub marked: std::collections::HashSet<usize>,
46 pub cached_matches: Vec<usize>,
47 pub paused: bool,
48}
49
50#[derive(Clone, Debug)]
51pub struct LogFilter {
52 pub field: Option<String>,
53 pub op: FilterOp,
54 pub value: String,
55}
56
57#[derive(Clone, Debug, PartialEq)]
58pub enum FilterOp {
59 Equals,
60 Contains,
61 NotEquals,
62 Since(u64),
63}