From 7ee7a6cea81498424f573cc478a7654eed4de00f Mon Sep 17 00:00:00 2001 From: acaldas Date: Thu, 16 May 2024 18:39:41 +0100 Subject: [PATCH] feat: dont use pretty-pino on production --- api/src/logger.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/src/logger.ts b/api/src/logger.ts index c48509fd..e613a209 100644 --- a/api/src/logger.ts +++ b/api/src/logger.ts @@ -2,6 +2,7 @@ import path from 'path'; import pino from 'pino'; import pinoHttp from 'pino-http'; import { loggerConfig } from '../logger.config'; +import { isDevelopment } from './env'; const { moduleFilter, prefixFilter, logLevel, httpLogLevel, @@ -58,9 +59,13 @@ const doesPassFilters = (config: { bindings: pino.Bindings; }): boolean => FILTERS.every((f) => f(config)); -const transportTargets: pino.TransportTargetOptions[] = [{ - target: 'pino-pretty', -}]; +const transportTargets: pino.TransportTargetOptions[] = []; + +if (isDevelopment) { + transportTargets.push({ + target: 'pino-pretty', + }); +} if (process.env.SENTRY_DSN) { transportTargets.push({