Skip to content

Commit

Permalink
Configure error options from env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rakhimundhada committed Dec 23, 2021
1 parent 3e732bc commit 11b1e3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, errors, json } = format;

const showStack = process.env.LOG_ERROR_OPTS ? { stack: process.env.LOG_ERROR_OPTS } : {};
const errorOptions = process.env.LOG_ERROR_OPTS ? JSON.parse(process.env.LOG_ERROR_OPTS) : {};
const logger = createLogger({
level: process.env.LOG_LEVEL || 'info',
format: combine(
timestamp(),
errors(showStack),
errors(errorOptions),
json()
),
transports: [
Expand Down

0 comments on commit 11b1e3a

Please sign in to comment.