Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartPruner ¶
StartPruner runs a background goroutine that prunes log entries older than the given retention duration. It prunes once immediately, then every 24 hours. The goroutine exits when ctx is cancelled.
Types ¶
type LogEntry ¶
type LogEntry struct {
ID int64 `json:"id"`
Timestamp time.Time `json:"ts"`
Level string `json:"level"`
Message string `json:"msg"`
Component string `json:"component,omitempty"`
SessionID string `json:"session_id,omitempty"`
IssueNumber int `json:"issue_number,omitempty"`
Fields string `json:"fields,omitempty"`
}
LogEntry represents a single structured log record persisted to SQLite.
type LogStore ¶
type LogStore struct {
// contains filtered or unexported fields
}
LogStore provides SQLite-backed structured log persistence.
func New ¶
New opens (or creates) a SQLite database at dbPath for log storage, enables WAL mode and busy_timeout, and runs migrations.
type QueryFilter ¶
type QueryFilter struct {
Level string
Component string
SessionID string
Issue int
Since time.Time
Until time.Time
Search string // substring match on msg
Limit int // default 100, max 1000
Offset int // for pagination
}
QueryFilter controls which log entries are returned by Query.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer is a zap-compatible WriteSyncer that tees log output to both stdout and a SQLite LogStore. SQLite errors are swallowed (logged to stderr) to ensure logging never crashes the application.
func NewSyncer ¶
NewSyncer creates a WriteSyncer that writes to stdout and persists structured JSON log lines to the given LogStore.