Skip to content

Commit

Permalink
refactor(logger): Refactor logger.js
Browse files Browse the repository at this point in the history
Use class style implement write interface
  • Loading branch information
a60814billy committed May 8, 2017
1 parent 90631df commit 036b241
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 036b241

Please sign in to comment.