var winston = require('winston');
var mkdirp = require('mkdirp');

// Init log path
if (!process.env.LOGPATH) {
    process.env.LOGPATH = './logs';
}
mkdirp(process.env.LOGPATH);

// Init Winston file logging
module.exports = new winston.Logger({
    transports: [
        new winston.transports.Console(),
        new winston.transports.File({
            filename: process.env.logpath + '/all.log'
        }),
    ],
    exceptionHandlers: [
        new winston.transports.File({
            filename: process.env.logpath + '/exceptions.log',
        })
    ]
})

if (process.env.LOGGLY_TOKEN) {
    require('winston-loggly');

    logger.add(winston.transports.Loggly, {
        token: process.env.LOGGLY_TOKEN,
        subdomain: process.env.LOGGLY_DOMAIN,
        json: true
    });
}

var winston = require('winston');
var mkdirp = require('mkdirp');

// Init log path
if (!process.env.LOGPATH) {
    process.env.LOGPATH = './logs';
}
mkdirp(process.env.LOGPATH);

// Init Winston file logging
module.exports = new winston.Logger({
    transports: [
        new winston.transports.Console(),
        new winston.transports.File({
            filename: process.env.logpath + '/all.log'
        }),
    ],
    exceptionHandlers: [
        new winston.transports.File({
            filename: process.env.logpath + '/exceptions.log',
        })
    ]
})

if (process.env.LOGGLY_TOKEN) {
    require('winston-loggly');

    module.exports.add(winston.transports.Loggly, {
        token: process.env.LOGGLY_TOKEN,
        subdomain: process.env.LOGGLY_DOMAIN,
        handleExceptions: true,
        humanReadableUnhandledException: true,
        json: true
    });
}

Fix crash error, send exceptions to loggly
Fix crash error, send exceptions to loggly
