mirror of
https://github.com/yuzu-emu/Command-fix
synced 2024-11-24 18:28:14 +00:00
38 lines
1,008 B
JavaScript
38 lines
1,008 B
JavaScript
var config = require('config');
|
|
var winston = require('winston');
|
|
var logdna = require('logdna');
|
|
var ip = require('ip');
|
|
var os = require("os");
|
|
|
|
winston.emitErrs = true;
|
|
var logger = new winston.Logger({
|
|
transports: [
|
|
new winston.transports.Console({
|
|
level: 'warn',
|
|
handleExceptions: true,
|
|
humanReadableUnhandledException: true,
|
|
json: false,
|
|
colorize: true
|
|
}),
|
|
new winston.transports.File({
|
|
filename: 'discord.log',
|
|
level: 'silly'
|
|
})
|
|
],
|
|
handleExceptions: true,
|
|
exitOnError: false
|
|
});
|
|
|
|
if (process.env.NODE_ENV == 'production' && config.logdnaKey) {
|
|
// Setup logging for LogDNA cloud logging.
|
|
logger.add(winston.transports.Logdna, {
|
|
level: 'info',
|
|
key: config.logdnaKey,
|
|
ip: ip.address(),
|
|
hostname: os.hostname(),
|
|
app: 'services-discordbot'
|
|
});
|
|
logger.info('[logging] Started LogDNA winston transport.');
|
|
}
|
|
|
|
module.exports = logger;
|