codimd/lib/logger.js

28 lines
549 B
JavaScript
Raw Normal View History

'use strict'
const { createLogger, format, transports } = require('winston')
2015-06-01 10:04:25 +00:00
const logger = createLogger({
level: 'debug',
format: format.combine(
format.uncolorize(),
format.timestamp(),
format.align(),
format.splat(),
format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
),
transports: [
new transports.Console({
handleExceptions: true
})
],
exitOnError: false
})
logger.stream = {
write: function (message, encoding) {
logger.info(message)
}
}
module.exports = logger