From c3584770f24205d84b9399abd9535cb27dc7b00c Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Tue, 13 Nov 2018 23:29:33 +0100 Subject: Upgrade winston Our log library got a new major version which should be implemented. That's exactly what this patch does. Implementing the new version of the logging library. Signed-off-by: Sheogorath --- lib/logger.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'lib/logger.js') 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 }) -- cgit v1.2.3