summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBoHong Li2017-03-19 01:21:43 +0800
committerRaccoon Li2017-05-08 19:24:37 +0800
commit036b2414f39ba9e97c562fd24742cbb812231af2 (patch)
treecce93c659fde35f37a0fd82f49b3f9ed2d3d153d /lib
parent90631df2ba924e3c71f611220290934d5ebb599e (diff)
refactor(logger): Refactor logger.js
Use class style implement write interface
Diffstat (limited to '')
-rw-r--r--lib/logger.js22
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)
- }
-}