logger.js 604 Bytes
/**
 * 日志工具类
 * @author: hbomb<qiqi.zhou@yoho.cn>
 * @date: 2016/05/06
 */
'use strict';

const winston = require('winston');
const config = require('../config/common');
const FileTransport = require('winston-daily-rotate-file');

require('influxdb-winston');

const logger = new (winston.Logger)({
    transports: [
        new (FileTransport)(config.loggers.infoFile),
        new (FileTransport)(config.loggers.errorFile),
        new (winston.transports.UdpTransport)(config.loggers.udp),
        new (winston.transports.Console)(config.loggers.console)
    ]
});

module.exports = logger;