mirror of https://github.com/status-im/codimd.git
refactor(logger): Refactor logger.js
Use class style implement write interface
This commit is contained in:
parent
90631df2ba
commit
036b2414f3
|
@ -1,23 +1,23 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
var winston = require('winston')
|
const winston = require('winston')
|
||||||
winston.emitErrs = true
|
|
||||||
|
|
||||||
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: [
|
transports: [
|
||||||
new winston.transports.Console({
|
new winston.transports.Console({
|
||||||
level: 'debug',
|
level: 'debug',
|
||||||
handleExceptions: true,
|
handleExceptions: true,
|
||||||
json: false,
|
json: false,
|
||||||
colorize: true,
|
colorize: false,
|
||||||
timestamp: true
|
timestamp: true
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
emitErrs: true,
|
||||||
exitOnError: false
|
exitOnError: false
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = logger
|
|
||||||
module.exports.stream = {
|
|
||||||
write: function (message, encoding) {
|
|
||||||
logger.info(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue