Add typed event logging and restructure server #11

Merged
probablycorey merged 3 commits from probablycorey/simple-logging into main 2026-03-10 16:28:41 +00:00

3 Commits

Author SHA1 Message Date
57fcf9616d Merge origin/main into probablycorey/simple-logging
Some checks failed
CI / test (pull_request) Has been cancelled
Resolve conflicts:
- package.json: keep server/index.tsx paths, adopt new test commands
- discord/index.ts: adopt startDiscord() wrapper, keep log() calls
- server/index.tsx: use startDiscord() import, keep logging structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:27:12 -07:00
96b6a4311b Remove redundant sha from StoredLogEvent type
Some checks failed
CI / test (pull_request) Has been cancelled
The sha is already encoded in the log filename (releaseSha_timestamp.jsonl), so there's no need to include it per-event. This simplifies the type and storage format.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 09:23:51 -07:00
04aa7c1c91 Add typed event logging system and restructure server
Implement a centralized logging system with typed events (webhook, PR, comment, review, Discord relay, errors, etc.) that feeds a pub/sub pattern. Events are logged to console (with ANSI colors: green=normal, yellow=skipped, red=errors, cyan=PR#) and persisted to JSONL files organized by git commit SHA.

Restructure server code into src/server/ directory with separate route handlers. Add a new /logs endpoint with an HTML viewer that displays events in a searchable table with type/repo filtering and browser timezone conversion. Remove the old /errors endpoint.

Improvements:
- All webhook handlers, Discord events, and errors now use log() instead of console.* calls
- Error objects are properly serialized to JSONL (message + stack extracted)
- Path traversal vulnerability fixed in readLogFile()
- Failed API calls and caught errors are now always logged
- Graceful error handling with fallbacks where appropriate (e.g., missing Discord users)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-10 08:58:47 -07:00