From 9979a4af9de2a6b9853c6d8d89642c492bc170d5 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Wed, 17 Jan 2024 00:25:22 +1100 Subject: [PATCH] Add debug logging to Logger class --- src/helpers/Logger.ts | 1 + src/models/userLevels.ts | 2 +- src/modules/YTModule.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/Logger.ts b/src/helpers/Logger.ts index 0ce5858..c4e2488 100644 --- a/src/helpers/Logger.ts +++ b/src/helpers/Logger.ts @@ -2,4 +2,5 @@ import dayjs from 'dayjs'; export default class Logger { public static console =(logType:'log'|'error', prefix:string, message:any)=>console[logType](`[${dayjs().format('DD/MM/YY HH:mm:ss')}]`, `[${prefix}]`, message); + public static debug =(prefix:string, message:any)=>console.log(`[${dayjs().format('DD/MM/YY HH:mm:ss')}]`, `[${prefix}:DEBUG]`, message); } diff --git a/src/models/userLevels.ts b/src/models/userLevels.ts index 1b5a4ba..8d6b8e3 100644 --- a/src/models/userLevels.ts +++ b/src/models/userLevels.ts @@ -114,7 +114,7 @@ export class UserLevelsSvc { )) ]}); } catch (why) { - Logger.console('error', 'Cron:resetAllData:DEBUG', why) + Logger.debug('Cron:resetAllData', why) } // Reset LRSstart to current Epoch and save it to config file diff --git a/src/modules/YTModule.ts b/src/modules/YTModule.ts index 27b7ad6..9dfdf98 100644 --- a/src/modules/YTModule.ts +++ b/src/modules/YTModule.ts @@ -43,7 +43,7 @@ export default async(client:TClient)=>{ continue; } if (getVideoId(1) === cachedVideoId) { - Logger.console('log', 'YTModule:DEBUG', `New video uploaded by ${YTChannelName} and notification sent to Discord`) + Logger.debug('YTModule', `New video uploaded by ${YTChannelName} and notification sent to Discord`) await CacheServer.delete(cacheKey).then(async()=>await CacheServer.set(cacheKey, getVideoId(0), false).then(async()=>await CacheServer.expiry(cacheKey, cacheExpiry))); (client.channels.resolve(DiscordChannelID) as TextChannel).send({