Refs #80 - Unified Debug Logging System
Migrate backend from Winston to Pino using API-compatible wrapper. Add correlation ID propagation.
backend/src/core/logging/logger.ts
backend/src/core/plugins/logging.plugin.ts
backend/package.json
docker-compose.yml
import pino from 'pino'; type LogLevel = 'debug' | 'info' | 'warn' | 'error'; const validLevels: LogLevel[] = ['debug', 'info', 'warn', 'error']; const rawLevel = (process.env.LOG_LEVEL?.toLowerCase() || 'info') as LogLevel; const level = validLevels.includes(rawLevel) ? rawLevel : 'info'; if (rawLevel !== level) { console.warn(`Invalid LOG_LEVEL "${process.env.LOG_LEVEL}", falling back to "info"`); } const pinoLogger = pino({ level, formatters: { level: (label) => ({ level: label }) }, }); // Wrapper maintains logger.info(msg, meta) API for 79 importing files export const logger = { info: (msg: string, meta?: object) => pinoLogger.info(meta || {}, msg), warn: (msg: string, meta?: object) => pinoLogger.warn(meta || {}, msg), error: (msg: string, meta?: object) => pinoLogger.error(meta || {}, msg), debug: (msg: string, meta?: object) => pinoLogger.debug(meta || {}, msg), child: (bindings: object) => { const childPino = pinoLogger.child(bindings); return { info: (msg: string, meta?: object) => childPino.info(meta || {}, msg), warn: (msg: string, meta?: object) => childPino.warn(meta || {}, msg), error: (msg: string, meta?: object) => childPino.error(meta || {}, msg), debug: (msg: string, meta?: object) => childPino.debug(meta || {}, msg), }; }, }; export default logger;
Add to docker-compose.yml postgres and redis services:
Depends on #80-A (config generator)
Milestone 2: Backend Logging
No dependencies set.
The note is not visible to the blocked user.
Parent Issue
Refs #80 - Unified Debug Logging System
Scope
Migrate backend from Winston to Pino using API-compatible wrapper. Add correlation ID propagation.
Files to Modify
backend/src/core/logging/logger.ts- Replace Winston with Pino wrapperbackend/src/core/plugins/logging.plugin.ts- Use @fastify/pino for request loggingbackend/package.json- Add pino, @fastify/pino; remove winstondocker-compose.yml- Add POSTGRES_LOG_* and REDIS_LOGLEVEL env varsImplementation Details
logger.ts (Pino wrapper maintaining Winston API)
Correlation ID Middleware
PostgreSQL/Redis Config
Add to docker-compose.yml postgres and redis services:
Acceptance Criteria
Dependencies
Depends on #80-A (config generator)
Milestone
Milestone 2: Backend Logging