Created
June 1, 2019 08:43
-
-
Save vanduc1102/bac7842daf90ca5180854766451424f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const log4js = require('log4js'); | |
const LOG_LEVEL = process.env.LOG_LEVEL || 'debug'; | |
if (LOG_LEVEL === 'debug') { | |
log4js.configure({ | |
appenders: { | |
out: { type: 'stdout', | |
layout: { | |
type: 'pattern', | |
pattern: '%[%d %p %f:%l %n%m%n %]' | |
} } | |
}, | |
categories: { default: { appenders: ['out'], level: LOG_LEVEL, enableCallStack: true } } | |
}); | |
} | |
const logger = log4js.getLogger(); | |
logger.level = LOG_LEVEL; | |
module.exports = logger; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment