api: ditch pino pretty for non-dev environments
Parents:
6559a001 file(s) changed
- api/src/createApp.ts +11 -8
api/src/createApp.ts
@@ -27,17 +27,20 @@ }));
27 27
28 28 app.use(bodyParser.json());
29 29
30 - // Create Pino logger
30 + const isDev = process.env.NODE_ENV !== 'production';
31 +
31 32 const logger = pino({
32 33 level: process.env.LOG_LEVEL || 'info',
33 - transport: {
34 - target: 'pino-pretty', // Human-readable in development
35 - options: {
36 - colorize: true,
37 - singleLine: false,
38 - messageFormat: '{if levelLabel}{levelLabel} - {end}{msg}',
34 + ...(isDev && {
35 + transport: {
36 + target: 'pino-pretty',
37 + options: {
38 + colorize: true,
39 + singleLine: false,
40 + messageFormat: '{if levelLabel}{levelLabel} - {end}{msg}',
41 + },
39 42 },
40 - },
43 + }),
41 44 });
42 45
43 46 // Use pino-http for HTTP logging (better than Morgan for structured logs)