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

Implements a typed event logging system as a pub/sub architecture that replaces ad-hoc console.log calls throughout the codebase. The server is restructured from a single file into a directory with multiple modules. Adds a log viewer page with file browser, event filtering, and timezone-aware timestamps. Improves observability of webhook handling, Discord events, and error conditions.

Implements a typed event logging system as a pub/sub architecture that replaces ad-hoc console.log calls throughout the codebase. The server is restructured from a single file into a directory with multiple modules. Adds a log viewer page with file browser, event filtering, and timezone-aware timestamps. Improves observability of webhook handling, Discord events, and error conditions.
probablycorey added 2 commits 2026-03-10 16:25:39 +00:00
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>
Remove redundant sha from StoredLogEvent type
Some checks failed
CI / test (pull_request) Has been cancelled
96b6a4311b
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>
probablycorey added 1 commit 2026-03-10 16:28:32 +00:00
Merge origin/main into probablycorey/simple-logging
Some checks failed
CI / test (pull_request) Has been cancelled
57fcf9616d
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>
probablycorey merged commit 1f386df256 into main 2026-03-10 16:28:41 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: probablycorey/workshop#11
No description provided.