Skip to content

chore: migrate log.Printf to log/slog in agent and cmd - #533

Open
brixtonpham wants to merge 1 commit into
BaaRai:mainfrom
brixtonpham:chore/slog-agent
Open

brixtonpham wants to merge 1 commit into
BaaRai:mainfrom
brixtonpham:chore/slog-agent

Conversation

@brixtonpham

Copy link
Copy Markdown

Problem / Context

Follow-up to #488 (traffic/, egress/, enrich/, evidence/) and disjoint from #523 (llmpool/, llmrec/, intercept/, db/). All remaining non-test log.Printf/log.Print/log.Println calls in agent/ and cmd/ still used unstructured formatting instead of log/slog, so the logs view had to guess severity from message text instead of reading the slog level word directly.

Changes

  • Replaced all 26 log.Print/log.Printf call sites across 11 files in agent/ (assembly.go, compaction.go, coverage.go, noa.go, provider.go, spill.go, toolrag.go, tools.go, tools_insert.go, triage.go, worker.go) and all 13 non-fatal log.Printf/log.Println call sites across cmd/artex/main.go and cmd/artex-archive-check/main.go with log/slog (slog.Info, slog.Warn, slog.Error).
  • Preserved every existing [tag] prefix ([agent], [compaction], [config], [coverage], [insert_assets], [llm-test], [noa], [tool-rag], [tools], [triage]) so server/logsink.go parseLog keeps the tag badges and reads the exact slog level word directly.
  • Kept the three process-terminating log.Fatal/log.Fatalf calls in cmd/ unchanged.
  • Flattened the [llm-test] connection-attempt log (agent/provider.go) into structured single-line attributes (response_body via clipBody) and structured [noa] diagnostics as a quoted msg attribute.
  • Added agent/slog_test.go verifying [tag] and slog level preservation through log.Default().

Testing

  • gofmt -l agent/ cmd/ — clean
  • Verified 0 remaining log.Print* calls in non-test agent/ and cmd/ files
  • go build ./... — passed
  • go vet ./... — passed
  • go test -race -p 1 ./agent ./cmd/... — passed (agent, cmd/artex; Postgres-dependent tests skipped without ARTEX_PG_DSN)
  • go test -p 1 ./server -run TestParseLog — passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant