zigbee2mqtt/lib/util/logger.js

18 lines
637 B
JavaScript
Raw Normal View History

2018-04-18 09:25:40 -07:00
const winston = require('winston');
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
timestamp: () => new Date().toLocaleString(),
formatter: function(options) {
return options.timestamp() + ' ' +
winston.config.colorize(options.level, options.level.toUpperCase()) + ' ' +
(options.message ? options.message : '') +
(options.meta && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' );
}
})
]
});
module.exports = logger;