Logging Strategy Enforcer
When to Trigger
- •Adding console.log
- •Error handling
- •Critical operations
What to Do
- •Structured logger: Use a logger (e.g. pino) with level and optional pretty transport in dev. Replace console.log with logger.info, console.error with logger.error, with context object (e.g. userId, bookingId).
- •Request context: For API routes, create child logger with requestId (from header or generated) so logs can be traced.
- •Never log: Passwords, tokens, full PII; redact or omit.
Pattern: logger.info({ key: value }, 'Message'). Use existing lib/logger if present.