From 7fe1149fd0154296421449ae431ada21d7564506 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Fri, 20 May 2022 23:11:33 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=91=20src/index.ts=20using=20old?= =?UTF-8?q?=20.then=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/index.ts b/src/index.ts index 573ff72..e502414 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,43 +17,19 @@ const main = async () => { }); // Start database manager - await database() - .then(async () => { - await logger.silly("Database process started"); - }) - .catch(async (err) => { - await logger.error(`${err}`); - }); + await database(); // Start schedule manager - await schedules(client) - .then(async () => { - await logger.silly("Schedules process started"); - }) - .catch(async (err) => { - await logger.error(`${err}`); - }); + await schedules(client); // Start command handler - await commands(client) - .then(async () => { - await logger.silly("Commands process started"); - }) - .catch(async (err) => { - await logger.error(`${err}`); - }); + await commands(client); // Start event handler - await events(client) - .then(async () => { - await logger.silly("Events process started"); - }) - .catch(async (err) => { - await logger.error(`${err}`); - }); + await events(client); // Authorize with Discord's API await client.login(token); }; -main() \ No newline at end of file +main(); From 6076b5f22063c40390af6b876b1eb5a4e2fd2142 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Fri, 20 May 2022 23:13:07 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=91=20logger=20module=20was=20usin?= =?UTF-8?q?g=20old=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/logger/index.ts | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/logger/index.ts b/src/logger/index.ts index c82f2ae..ae96924 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -3,31 +3,24 @@ import "winston-daily-rotate-file"; const { combine, timestamp, printf, colorize, align, json } = winston.format; -module.exports = { - // Logger initialized async-hronously - logger: async () => { - return winston.createLogger({ - level: process.env.LOG_LEVEL || "silly", - transports: [ - new winston.transports.DailyRotateFile({ - filename: "logs/combined-%DATE%.log", - datePattern: "YYYY-MM-DD", - maxFiles: "14d", - format: combine(timestamp(), json()), +export default winston.createLogger({ + level: process.env.LOG_LEVEL || "silly", + transports: [ + new winston.transports.DailyRotateFile({ + filename: "logs/combined-%DATE%.log", + datePattern: "YYYY-MM-DD", + maxFiles: "14d", + format: combine(timestamp(), json()), + }), + new winston.transports.Console({ + format: combine( + colorize({ all: true }), + timestamp({ + format: "YYYY-MM-DD HH:MM:ss", }), - new winston.transports.Console({ - format: combine( - colorize({ all: true }), - timestamp({ - format: "YYYY-MM-DD HH:MM:ss", - }), - align(), - printf( - (info) => `[${info.timestamp}] ${info.level}: ${info.message}` - ) - ), - }), - ], - }); - }, -}; + align(), + printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`) + ), + }), + ], +});