From 6d2d1fec72ba5de3aac12e5b6ae9448fe4a8fba6 Mon Sep 17 00:00:00 2001 From: Navy Date: Thu, 13 Aug 2020 23:44:58 +0300 Subject: [PATCH] move process error listener to logger --- index.js | 6 +----- middleware/logger/Logger.js | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index b622448..979a563 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,4 @@ const Manager = require('./Manager.js'); const options = require('./options.json'); new Manager(options) - .build(); - -process.on("unhandledRejection", (error) => { - console.error("Unhandled promise rejection:", error); //eslint-disable-line no-console -}); \ No newline at end of file + .build(); \ No newline at end of file diff --git a/middleware/logger/Logger.js b/middleware/logger/Logger.js index f66aeae..09c7dee 100644 --- a/middleware/logger/Logger.js +++ b/middleware/logger/Logger.js @@ -39,7 +39,11 @@ class Logger { //TODO: Add proper date-oriented filenames and add a daily rotation file (?). this.shardManager - .on('shardCreate', (shard) => this.write('debug', "Shard created.", shard)); + .on('shardCreate', (shard) => this.write('info', "Shard created.", shard)); + + process.on("unhandledRejection", (error) => { + this.write('error', `Unhandled promise rejection:\n${error.stack}`); //eslint-disable-line no-console + }); }