add: SQLite-backed structured logging with retention

Replace JSON/file logging with a logs.db (WAL) store. Thread the logger
through the encoder and metadata client for debug instrumentation of every
ffmpeg/ffprobe/opusenc invocation and OMDb/TVmaze request. API keys are
redacted before request URLs are logged. Retention defaults to 7 days,
overridable via log_retention_days in config.
This commit is contained in:
Esa Kataja
2026-06-21 17:08:23 +03:00
parent 6a564aabb2
commit f39f5b1b16
8 changed files with 221 additions and 134 deletions
+4 -15
View File
@@ -1,9 +1,5 @@
package types
import (
"time"
)
type MediaType string
const (
@@ -36,9 +32,10 @@ type Metadata struct {
}
type Config struct {
OMDBAPIKey string `yaml:"omdb_api_key"`
Encoding EncodingConfig
Paths PathsConfig
OMDBAPIKey string `yaml:"omdb_api_key"`
LogRetentionDays int `yaml:"log_retention_days"`
Encoding EncodingConfig
Paths PathsConfig
}
type EncodingConfig struct {
@@ -60,11 +57,3 @@ type PathsConfig struct {
Failed string `yaml:"failed"`
Work string `yaml:"work"`
}
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
File string `json:"file,omitempty"`
Error string `json:"error,omitempty"`
}