diff options
author | BoHong Li | 2017-03-19 01:21:43 +0800 |
---|---|---|
committer | Raccoon Li | 2017-05-08 19:24:37 +0800 |
commit | 036b2414f39ba9e97c562fd24742cbb812231af2 (patch) | |
tree | cce93c659fde35f37a0fd82f49b3f9ed2d3d153d /lib | |
parent | 90631df2ba924e3c71f611220290934d5ebb599e (diff) |
refactor(logger): Refactor logger.js
Use class style implement write interface
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logger.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/logger.js b/lib/logger.js index 2111d69a..f8b3895c 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,23 +1,23 @@ 'use strict' -var winston = require('winston') -winston.emitErrs = true +const winston = require('winston') -var logger = new winston.Logger({ +class Logger extends winston.Logger { + // Implement stream.writable.write interface + write (chunk) { + this.info(chunk) + } +} + +module.exports = new Logger({ transports: [ new winston.transports.Console({ level: 'debug', handleExceptions: true, json: false, - colorize: true, + colorize: false, timestamp: true }) ], + emitErrs: true, exitOnError: false }) - -module.exports = logger -module.exports.stream = { - write: function (message, encoding) { - logger.info(message) - } -} |