Skip to content

Commit

Permalink
Do not enable pretty logging in prod mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Feb 13, 2024
1 parent bdcac8d commit ebdc847
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ const CACHE_STDTTL = config.get<number>('cache.stdTTL');
const CACHE_CHECKPERIOD = config.get<number>('cache.checkperiod');

let logger : Logger;
try {
const pretty = require('pino-pretty');
logger = pino({ level: LOGLEVEL }, pretty());
} catch (error) {
if (process.env.NODE_ENV !== 'production') {
try {
const pretty = require('pino-pretty');
logger = pino({ level: LOGLEVEL }, pretty());
} catch (error) {
logger = pino({ level: LOGLEVEL });
}
} else {
logger = pino({ level: LOGLEVEL });
}

Expand Down

0 comments on commit ebdc847

Please sign in to comment.