mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
refactor(logger): Refactor logger.js
Use class style implement write interface
This commit is contained in:
parent
90631df2ba
commit
036b2414f3
1 changed files with 11 additions and 11 deletions
|
@ -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 a new issue