diff options
author | Christoph (Sheogorath) Kern | 2018-11-14 12:13:43 +0100 |
---|---|---|
committer | GitHub | 2018-11-14 12:13:43 +0100 |
commit | f9aa001ee78e604415c2a6e82f65701a1f07d3c4 (patch) | |
tree | 9e6a3565806a5685ccd08d7060e4a8d5e1bd164b /lib/logger.js | |
parent | fc49326b947dcd11eddae2b0f79b76a4136e1f00 (diff) | |
parent | c3584770f24205d84b9399abd9535cb27dc7b00c (diff) |
Merge pull request #1055 from SISheogorath/upgrade/winston
Upgrade winston / refactor logging
Diffstat (limited to '')
-rw-r--r-- | lib/logger.js | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/logger.js b/lib/logger.js index f8b3895c..c70b81b8 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,23 +1,19 @@ 'use strict' -const winston = require('winston') +const {createLogger, format, transports} = require('winston') -class Logger extends winston.Logger { - // Implement stream.writable.write interface - write (chunk) { - this.info(chunk) - } -} - -module.exports = new Logger({ +module.exports = createLogger({ + level: 'debug', + format: format.combine( + format.uncolorize(), + format.timestamp(), + format.align(), + format.splat(), + format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`) + ), transports: [ - new winston.transports.Console({ - level: 'debug', - handleExceptions: true, - json: false, - colorize: false, - timestamp: true + new transports.Console({ + handleExceptions: true }) ], - emitErrs: true, exitOnError: false }) |