Skip to content

Commit

Permalink
feat: dont use pretty-pino on production
Browse files Browse the repository at this point in the history
  • Loading branch information
acaldas committed May 16, 2024
1 parent 8d985b6 commit 7ee7a6c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 7ee7a6c

Please sign in to comment.