Summary - extend the log client to accept an optional `--search` substring filter when querying codex-state logs - propagate the filter through `LogQuery` and apply it in `push_log_filters` via `INSTR(message, ...)` - add an integration test that exercises the new search filtering behavior Testing - Not run (not requested)
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
use serde::Serialize;
|
|
use sqlx::FromRow;
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
pub struct LogEntry {
|
|
pub ts: i64,
|
|
pub ts_nanos: i64,
|
|
pub level: String,
|
|
pub target: String,
|
|
pub message: Option<String>,
|
|
pub thread_id: Option<String>,
|
|
pub process_uuid: Option<String>,
|
|
pub module_path: Option<String>,
|
|
pub file: Option<String>,
|
|
pub line: Option<i64>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, FromRow)]
|
|
pub struct LogRow {
|
|
pub id: i64,
|
|
pub ts: i64,
|
|
pub ts_nanos: i64,
|
|
pub level: String,
|
|
pub target: String,
|
|
pub message: Option<String>,
|
|
pub thread_id: Option<String>,
|
|
pub process_uuid: Option<String>,
|
|
pub file: Option<String>,
|
|
pub line: Option<i64>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default)]
|
|
pub struct LogQuery {
|
|
pub level_upper: Option<String>,
|
|
pub from_ts: Option<i64>,
|
|
pub to_ts: Option<i64>,
|
|
pub module_like: Vec<String>,
|
|
pub file_like: Vec<String>,
|
|
pub thread_ids: Vec<String>,
|
|
pub search: Option<String>,
|
|
pub include_threadless: bool,
|
|
pub after_id: Option<i64>,
|
|
pub limit: Option<usize>,
|
|
pub descending: bool,
|
|
}
|