Skip to content

Add request/response logging with SSE parsing#1

Open
monofon wants to merge 1 commit intomainfrom
feature/request-response-logging
Open

Add request/response logging with SSE parsing#1
monofon wants to merge 1 commit intomainfrom
feature/request-response-logging

Conversation

@monofon
Copy link
Contributor

@monofon monofon commented Oct 29, 2025

Summary

  • Added comprehensive request/response logging functionality with Server-Sent Events (SSE) parsing
  • Implemented structured logging to JSON files with timestamps
  • Added configuration support via enableLogging flag
  • Protected sensitive configuration with .gitignore and example config template
  • Updated systemd service configuration to use correct Node.js path

Changes

  • Logging System: Parse SSE streams from OpenAI API and extract completed responses
  • Configuration: Add config.example.json template and ignore actual config.json
  • Log Management: Automatic log directory creation and timestamped JSON log files
  • Service Config: Update systemd service to use linuxbrew Node.js installation

Test plan

  • Verify logging is disabled by default in config.example.json
  • Test that config.json is properly ignored by git
  • Send test requests and verify log files are created in log/ directory
  • Confirm SSE parsing correctly extracts response data
  • Validate JSON log file structure includes timestamp, request, and response
  • Test systemd service starts correctly with updated configuration

🤖 Generated with Claude Code

Add optional logging functionality that captures request bodies and parsed response.completed events to individual JSON files. Includes SSE stream parser to extract structured data from OpenAI API responses. Logging can be enabled/disabled via config.

- Add fs/promises for async file operations
- Implement parseSSE() to extract JSON from SSE data events
- Collect response chunks during streaming
- Write logs to timestamped files in log/ directory
- Add enableLogging config option
- Update .gitignore to exclude sensitive config and logs
- Add config.example.json template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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