mirror of
https://github.com/citra-emu/discord-bot.git
synced 2025-02-28 23:16:54 +00:00
* Silence git about my local IDE files This was copy-pasted from Citras .gitignore file. * Fix some typos * Prevent coercion warning * Fix the rest of EsLinter warnings Fixes wrong spacing, missing semicolons, unecessary RegEx escapes, unecessary undefined init and unused variables. * Replace var with const or let
36 lines
827 B
JavaScript
36 lines
827 B
JavaScript
const winston = require('winston');
|
|
const ip = require('ip');
|
|
const os = require('os');
|
|
|
|
winston.emitErrs = true;
|
|
|
|
const logger = new winston.Logger({
|
|
level: 'debug',
|
|
transports: [
|
|
new (winston.transports.Console)()
|
|
],
|
|
handleExceptions: true,
|
|
humanReadableUnhandledException: true,
|
|
exitOnError: false,
|
|
meta: true
|
|
});
|
|
|
|
// Setup logging for LogDNA cloud logging.
|
|
if (process.env.LOGDNA_API_KEY) {
|
|
require('logdna');
|
|
const logLevel = process.env.LOGDNA_LEVEL || 'info';
|
|
|
|
logger.add(winston.transports.Logdna, {
|
|
level: logLevel,
|
|
app: process.env.LOGDNA_APPNAME,
|
|
index_meta: true,
|
|
key: process.env.LOGDNA_API_KEY,
|
|
ip: ip.address(),
|
|
hostname: os.hostname()
|
|
});
|
|
|
|
logger.info(`[core] Started LogDNA winston transport. Running at log level ${logLevel}.`);
|
|
}
|
|
|
|
module.exports = logger;
|