diff --git a/apps/platform/.env.example b/apps/platform/.env.example index a5ccd8aa..45542a8f 100644 --- a/apps/platform/.env.example +++ b/apps/platform/.env.example @@ -2,6 +2,7 @@ NODE_ENV=development PORT=3001 APP_SECRET= LOG_LEVEL=info +LOG_PRETTY_PRINT=true DB_HOST=127.0.0.1 DB_USERNAME=parcelvoy diff --git a/apps/platform/src/config/logger.ts b/apps/platform/src/config/logger.ts index dd8ce0bd..3407f94b 100644 --- a/apps/platform/src/config/logger.ts +++ b/apps/platform/src/config/logger.ts @@ -2,10 +2,9 @@ import pino from 'pino' import pretty from 'pino-pretty' import ErrorHandler, { ErrorConfig } from '../error/ErrorHandler' -// TODO: Check ENV and disable prettier for production export const logger = pino({ level: process.env.LOG_LEVEL || 'warn', -}, pretty({ colorize: true })) +}, process.env.LOG_PRETTY_PRINT ? pretty({ colorize: true }) : undefined) export default async (config: ErrorConfig) => { return new ErrorHandler(config)