Skip to content

feat(llm): add per-provider interaction logging to file#17

Merged
liut merged 1 commit intomainfrom
feature-llm-logger-to-file
Apr 20, 2026
Merged

feat(llm): add per-provider interaction logging to file#17
liut merged 1 commit intomainfrom
feature-llm-logger-to-file

Conversation

@liut
Copy link
Copy Markdown
Owner

@liut liut commented Apr 20, 2026

Add LogDir config to each Provider (openai/anthropic) for writing LLM interaction logs as JSONL files named by date and provider.

  • Add LogDir field to settings.Provider struct
  • Add logDir to llm.config and WithLogDir option
  • Add audit.go with InteractionLog struct and LogInteraction func using mutex-protected open-write-close pattern (no file handle cache)
  • Wire logging into openai.go Chat and StreamChat (parseStreamResponse)
  • Wire logging into anthropic.go Chat and StreamChat (message_delta)
  • Pass WithLogDir to all three llm clients in stores/llm.go

Add LogDir config to each Provider (openai/anthropic) for writing
LLM interaction logs as JSONL files named by date and provider.

- Add LogDir field to settings.Provider struct
- Add logDir to llm.config and WithLogDir option
- Add audit.go with InteractionLog struct and LogInteraction func
  using mutex-protected open-write-close pattern (no file handle cache)
- Wire logging into openai.go Chat and StreamChat (parseStreamResponse)
- Wire logging into anthropic.go Chat and StreamChat (message_delta)
- Pass WithLogDir to all three llm clients in stores/llm.go
@liut liut merged commit 9c0d267 into main Apr 20, 2026
2 checks 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