2017-03-14 05:02:43 +00:00
|
|
|
'use strict'
|
2019-04-12 09:56:46 +00:00
|
|
|
const { createLogger, format, transports } = require('winston')
|
2015-06-01 10:04:25 +00:00
|
|
|
|
2018-11-16 10:42:52 +00:00
|
|
|
const logger = createLogger({
|
2018-11-13 22:29:33 +00:00
|
|
|
level: 'debug',
|
|
|
|
format: format.combine(
|
|
|
|
format.uncolorize(),
|
|
|
|
format.timestamp(),
|
|
|
|
format.align(),
|
|
|
|
format.splat(),
|
|
|
|
format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
|
|
|
|
),
|
2017-03-08 10:45:51 +00:00
|
|
|
transports: [
|
2018-11-13 22:29:33 +00:00
|
|
|
new transports.Console({
|
|
|
|
handleExceptions: true
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
|
|
|
],
|
|
|
|
exitOnError: false
|
|
|
|
})
|
2018-11-16 10:42:52 +00:00
|
|
|
|
|
|
|
logger.stream = {
|
|
|
|
write: function (message, encoding) {
|
|
|
|
logger.info(message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = logger
|