Command-fix/logging.js

31 lines
768 B
JavaScript
Raw Normal View History

2016-12-07 22:52:37 -05:00
var winston = require('winston');
winston.emitErrs = true;
var logger = new winston.Logger({
transports: [
new winston.transports.Console({
2017-03-14 23:55:22 -04:00
level: 'silly',
handleExceptions: true,
humanReadableUnhandledException: true,
json: false,
colorize: true
2016-12-07 22:52:37 -05:00
})
],
2017-03-14 23:55:22 -04:00
handleExceptions: true,
2016-12-07 22:52:37 -05:00
exitOnError: false
});
2017-03-14 23:55:22 -04:00
if (process.env.NODE_ENV == 'production') {
// Setup logging for LogDNA cloud logging.
logger.add(winston.transports.Logdna, {
level: 'silly',
key: config.logdnaKey,
ip: ip.address(),
hostname: os.hostname(),
app: 'services-discordbot'
});
logger.info('[logging] Started LogDNA winston transport.');
}
2016-12-07 22:52:37 -05:00
module.exports = logger;