From ab67e4116be3faf0fb92547c63bb78e2d09c0e77 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Tue, 28 Oct 2025 22:50:44 +0100 Subject: [PATCH] feat: enhance logger configuration with ISO 8601 timestamps and improved pino-pretty transport settings for production environments --- src/lib/logger.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/logger.ts b/src/lib/logger.ts index a751067..1daa302 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -4,8 +4,21 @@ const isProduction = process.env.NODE_ENV === 'production'; const logger = pino({ level: isProduction ? 'info' : 'debug', + // Format timestamp en ISO 8601 lisible en prod + timestamp: () => `,"time":"${new Date().toISOString()}"`, ...(isProduction - ? {} + ? { + // En prod, utiliser pino-pretty aussi pour des logs lisibles + transport: { + target: 'pino-pretty', + options: { + colorize: true, + translateTime: 'SYS:dd/mm/yyyy HH:MM:ss', + ignore: 'pid,hostname', + singleLine: false, + }, + }, + } : { transport: { target: 'pino-pretty',