Skip to main content

systemprompt_logging/models/
log_row.rs

1//! Test-only `LogRow` shape exposed for unit tests that exercise the row→entry
2//! mapping shape. Production read paths use local non-Option `LogRow` structs
3//! defined in `repository/operations/queries.rs` and
4//! `trace/log_lookup_queries.rs`; they do not go through this type. The struct
5//! is preserved because removing it would force a cross-cutting rewrite of the
6//! logging test surface; it must not be used in production code.
7
8use chrono::{DateTime, Utc};
9use sqlx::FromRow;
10use systemprompt_identifiers::{ClientId, ContextId, LogId, SessionId, TaskId, TraceId, UserId};
11
12#[derive(Debug, FromRow)]
13pub struct LogRow {
14    pub id: LogId,
15    pub timestamp: DateTime<Utc>,
16    pub level: String,
17    pub module: String,
18    pub message: String,
19    pub metadata: Option<String>,
20    pub user_id: UserId,
21    pub session_id: SessionId,
22    pub task_id: Option<TaskId>,
23    pub trace_id: TraceId,
24    pub context_id: Option<ContextId>,
25    pub client_id: Option<ClientId>,
26}