From 2f9549adefedb5753e6f119757905b4b0bb981ad Mon Sep 17 00:00:00 2001 From: Collin Duncan <3679940+cgduncan7@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:54:13 +0200 Subject: [PATCH] Changing some logs from log to debug level --- src/email/client.ts | 2 +- src/members/service.ts | 2 +- src/recurringReservations/cron.ts | 6 +++--- src/reservations/cron.ts | 18 +++++++++--------- src/waitingList/service.ts | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/email/client.ts b/src/email/client.ts index 584856a..6baf1cf 100644 --- a/src/email/client.ts +++ b/src/email/client.ts @@ -97,7 +97,7 @@ export class EmailClient { numMessages: number, callback: (emails: Email[]) => Promise, ) { - this.loggerService.log(`Received ${numMessages} emails`) + this.loggerService.debug(`Received ${numMessages} emails`) const mailbox = await new Promise((res) => this.getMailbox(res)) const { diff --git a/src/members/service.ts b/src/members/service.ts index 608d323..2a94afe 100644 --- a/src/members/service.ts +++ b/src/members/service.ts @@ -92,7 +92,7 @@ export class MembersService { }, ) if (!redirected && response.status >= 300 && response.status < 400) { - this.loggerService.log('Not logged in, logging in and re-requesting') + this.loggerService.debug('Not logged in, logging in and re-requesting') await this.login() return await this.findMembers(query, true) } diff --git a/src/recurringReservations/cron.ts b/src/recurringReservations/cron.ts index eba0444..2e5133b 100644 --- a/src/recurringReservations/cron.ts +++ b/src/recurringReservations/cron.ts @@ -24,14 +24,14 @@ export class RecurringReservationsCronService { timeZone: 'Europe/Amsterdam', }) async handleRecurringReservations() { - this.loggerService.log('handleRecurringReservations beginning') + this.loggerService.debug('handleRecurringReservations beginning') await this.ntfyProvider.sendCronStartNotification( 'handleRecurringReservations', ) const dayOfWeek = dayjs().get('day') const recurringReservationsToSchedule = await this.recurringReservationsService.getByDayOfWeek(dayOfWeek) - this.loggerService.log( + this.loggerService.debug( `Found ${recurringReservationsToSchedule.length} recurring reservations to schedule`, ) for (const recurringReservation of recurringReservationsToSchedule) { @@ -39,7 +39,7 @@ export class RecurringReservationsCronService { recurringReservation, ) } - this.loggerService.log('handleRecurringReservations ending') + this.loggerService.debug('handleRecurringReservations ending') await this.ntfyProvider.sendCronStopNotification( 'handleRecurringReservations', `Count: ${recurringReservationsToSchedule.length}`, diff --git a/src/reservations/cron.ts b/src/reservations/cron.ts index 31e7a9c..41377c1 100644 --- a/src/reservations/cron.ts +++ b/src/reservations/cron.ts @@ -49,18 +49,18 @@ export class ReservationsCronService { timeZone: 'Europe/Amsterdam', }) async handleDailyReservations() { - this.loggerService.log('handleDailyReservations beginning') + this.loggerService.debug('handleDailyReservations beginning') await this.ntfyProvider.sendCronStartNotification('handleDailyReservations') const reservationsToPerform = await this.reservationService.getSchedulable() if (reservationsToPerform.length > 0) { - this.loggerService.log( + this.loggerService.debug( `Found ${reservationsToPerform.length} reservations to perform`, ) // In order to make sure session is fresh and speed up some shit let's warm him up await this.brService.warmup() - this.loggerService.log(`Warmed up! Waiting for go-time`) + this.loggerService.debug(`Warmed up! Waiting for go-time`) await this.sleepUntil( dayjs() @@ -70,7 +70,7 @@ export class ReservationsCronService { .set('millisecond', 0), ) - this.loggerService.log(`It's go-time`) + this.loggerService.debug(`It's go-time`) for (const res of reservationsToPerform) { await this.brService.performReservation(res).catch( @@ -81,10 +81,10 @@ export class ReservationsCronService { ) } } else { - this.loggerService.log('Monitoring reservations') + this.loggerService.debug('Monitoring reservations') await this.brService.monitorCourtReservations(dayjs().add(7, 'day')) } - this.loggerService.log('handleDailyReservations ending') + this.loggerService.debug('handleDailyReservations ending') await this.ntfyProvider.sendCronStopNotification( 'handleDailyReservations', `Count: ${reservationsToPerform.length}`, @@ -96,18 +96,18 @@ export class ReservationsCronService { timeZone: 'Europe/Amsterdam', }) async cleanUpExpiredReservations() { - this.loggerService.log('cleanUpExpiredReservations beginning') + this.loggerService.debug('cleanUpExpiredReservations beginning') await this.ntfyProvider.sendCronStartNotification( 'cleanUpExpiredReservations', ) const reservations = await this.reservationService.getByDate() - this.loggerService.log( + this.loggerService.debug( `Found ${reservations.length} reservations to delete`, ) for (const reservation of reservations) { await this.reservationService.deleteById(reservation.id) } - this.loggerService.log('cleanUpExpiredReservations ending') + this.loggerService.debug('cleanUpExpiredReservations ending') await this.ntfyProvider.sendCronStopNotification( 'cleanUpExpiredReservations', `Count: ${reservations.length}`, diff --git a/src/waitingList/service.ts b/src/waitingList/service.ts index 596f625..96cf6b6 100644 --- a/src/waitingList/service.ts +++ b/src/waitingList/service.ts @@ -50,7 +50,7 @@ export class WaitingListService { @Process() async processEmail(job: Job) { const { data: email } = job - this.loggerService.log('Handling email', { + this.loggerService.debug('Handling email', { id: email.id, from: email.from, subject: email.subject, @@ -90,7 +90,7 @@ export class WaitingListService { return } - this.loggerService.log( + this.loggerService.debug( `Found ${reservations.length} reservations on waiting list`, ) @@ -125,7 +125,7 @@ export class WaitingListService { private isRelevantEmail(email: Email): boolean { if (!EMAIL_SUBJECT_REGEX.test(email.subject)) { - this.loggerService.log('Ignoring email, irrelevant subject', { + this.loggerService.debug('Ignoring email, irrelevant subject', { id: email.id, subject: email.subject, }) @@ -133,7 +133,7 @@ export class WaitingListService { } if (EMAIL_ADDRESS !== email.from) { - this.loggerService.log('Ignoring email, irrelevant sender', { + this.loggerService.debug('Ignoring email, irrelevant sender', { id: email.id, sender: email.from, })