Problem
The realtime server uses console.log / console.error for all logging. In production, this makes debugging and monitoring difficult.
Current State
- All events logged with
console.log (connection, disconnection, room lifecycle)
- All errors logged with
console.error (generic message + error)
- No structured format (JSON)
- No log levels (debug, info, warn, error)
- No request correlation IDs
- No error categorization (auth vs network vs protocol)
- No metrics collection
What's Needed
- Structured logging — JSON format with timestamp, level, context
- Error categorization — Distinguish auth errors, network errors, protocol errors, internal errors
- Correlation IDs — Track operations across socket events
- Health metrics — Room count, peer count, producer/consumer count, memory usage
- Log library — Consider pino or winston for structured logging
Also Missing
- No
io.on("error") or io.on("connection_error") handler on the Socket.IO server
- Connection errors are silently lost
Acceptance Criteria
Problem
The realtime server uses
console.log/console.errorfor all logging. In production, this makes debugging and monitoring difficult.Current State
console.log(connection, disconnection, room lifecycle)console.error(generic message + error)What's Needed
Also Missing
io.on("error")orio.on("connection_error")handler on the Socket.IO serverAcceptance Criteria