Skip to content

Commit

Permalink
configure stack trace option conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
rakhimundhada committed Dec 22, 2021
1 parent af178bc commit 3e732bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = {
Util : require('./al_aws'),
Health : require('./health_checks'),
Stats: require('./statistics_templates'),
logger: require('./logger')
Logger: require('./logger')
};

3 changes: 2 additions & 1 deletion logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +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 logger = createLogger({
level: process.env.LOG_LEVEL || 'info',
format: combine(
timestamp(),
errors({ stack: true }),
errors(showStack),
json()
),
transports: [
Expand Down

0 comments on commit 3e732bc

Please sign in to comment.