Changing some logs from log to debug level

This commit is contained in:
Collin Duncan 2024-04-11 09:54:13 +02:00
parent 45bc15eee5
commit 2f9549adef
No known key found for this signature in database
5 changed files with 18 additions and 18 deletions

View file

@ -97,7 +97,7 @@ export class EmailClient {
numMessages: number, numMessages: number,
callback: (emails: Email[]) => Promise<void>, callback: (emails: Email[]) => Promise<void>,
) { ) {
this.loggerService.log(`Received ${numMessages} emails`) this.loggerService.debug(`Received ${numMessages} emails`)
const mailbox = await new Promise<Imap.Box>((res) => this.getMailbox(res)) const mailbox = await new Promise<Imap.Box>((res) => this.getMailbox(res))
const { const {

View file

@ -92,7 +92,7 @@ export class MembersService {
}, },
) )
if (!redirected && response.status >= 300 && response.status < 400) { 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() await this.login()
return await this.findMembers(query, true) return await this.findMembers(query, true)
} }

View file

@ -24,14 +24,14 @@ export class RecurringReservationsCronService {
timeZone: 'Europe/Amsterdam', timeZone: 'Europe/Amsterdam',
}) })
async handleRecurringReservations() { async handleRecurringReservations() {
this.loggerService.log('handleRecurringReservations beginning') this.loggerService.debug('handleRecurringReservations beginning')
await this.ntfyProvider.sendCronStartNotification( await this.ntfyProvider.sendCronStartNotification(
'handleRecurringReservations', 'handleRecurringReservations',
) )
const dayOfWeek = dayjs().get('day') const dayOfWeek = dayjs().get('day')
const recurringReservationsToSchedule = const recurringReservationsToSchedule =
await this.recurringReservationsService.getByDayOfWeek(dayOfWeek) await this.recurringReservationsService.getByDayOfWeek(dayOfWeek)
this.loggerService.log( this.loggerService.debug(
`Found ${recurringReservationsToSchedule.length} recurring reservations to schedule`, `Found ${recurringReservationsToSchedule.length} recurring reservations to schedule`,
) )
for (const recurringReservation of recurringReservationsToSchedule) { for (const recurringReservation of recurringReservationsToSchedule) {
@ -39,7 +39,7 @@ export class RecurringReservationsCronService {
recurringReservation, recurringReservation,
) )
} }
this.loggerService.log('handleRecurringReservations ending') this.loggerService.debug('handleRecurringReservations ending')
await this.ntfyProvider.sendCronStopNotification( await this.ntfyProvider.sendCronStopNotification(
'handleRecurringReservations', 'handleRecurringReservations',
`Count: ${recurringReservationsToSchedule.length}`, `Count: ${recurringReservationsToSchedule.length}`,

View file

@ -49,18 +49,18 @@ export class ReservationsCronService {
timeZone: 'Europe/Amsterdam', timeZone: 'Europe/Amsterdam',
}) })
async handleDailyReservations() { async handleDailyReservations() {
this.loggerService.log('handleDailyReservations beginning') this.loggerService.debug('handleDailyReservations beginning')
await this.ntfyProvider.sendCronStartNotification('handleDailyReservations') await this.ntfyProvider.sendCronStartNotification('handleDailyReservations')
const reservationsToPerform = await this.reservationService.getSchedulable() const reservationsToPerform = await this.reservationService.getSchedulable()
if (reservationsToPerform.length > 0) { if (reservationsToPerform.length > 0) {
this.loggerService.log( this.loggerService.debug(
`Found ${reservationsToPerform.length} reservations to perform`, `Found ${reservationsToPerform.length} reservations to perform`,
) )
// In order to make sure session is fresh and speed up some shit let's warm him up // In order to make sure session is fresh and speed up some shit let's warm him up
await this.brService.warmup() 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( await this.sleepUntil(
dayjs() dayjs()
@ -70,7 +70,7 @@ export class ReservationsCronService {
.set('millisecond', 0), .set('millisecond', 0),
) )
this.loggerService.log(`It's go-time`) this.loggerService.debug(`It's go-time`)
for (const res of reservationsToPerform) { for (const res of reservationsToPerform) {
await this.brService.performReservation(res).catch( await this.brService.performReservation(res).catch(
@ -81,10 +81,10 @@ export class ReservationsCronService {
) )
} }
} else { } else {
this.loggerService.log('Monitoring reservations') this.loggerService.debug('Monitoring reservations')
await this.brService.monitorCourtReservations(dayjs().add(7, 'day')) await this.brService.monitorCourtReservations(dayjs().add(7, 'day'))
} }
this.loggerService.log('handleDailyReservations ending') this.loggerService.debug('handleDailyReservations ending')
await this.ntfyProvider.sendCronStopNotification( await this.ntfyProvider.sendCronStopNotification(
'handleDailyReservations', 'handleDailyReservations',
`Count: ${reservationsToPerform.length}`, `Count: ${reservationsToPerform.length}`,
@ -96,18 +96,18 @@ export class ReservationsCronService {
timeZone: 'Europe/Amsterdam', timeZone: 'Europe/Amsterdam',
}) })
async cleanUpExpiredReservations() { async cleanUpExpiredReservations() {
this.loggerService.log('cleanUpExpiredReservations beginning') this.loggerService.debug('cleanUpExpiredReservations beginning')
await this.ntfyProvider.sendCronStartNotification( await this.ntfyProvider.sendCronStartNotification(
'cleanUpExpiredReservations', 'cleanUpExpiredReservations',
) )
const reservations = await this.reservationService.getByDate() const reservations = await this.reservationService.getByDate()
this.loggerService.log( this.loggerService.debug(
`Found ${reservations.length} reservations to delete`, `Found ${reservations.length} reservations to delete`,
) )
for (const reservation of reservations) { for (const reservation of reservations) {
await this.reservationService.deleteById(reservation.id) await this.reservationService.deleteById(reservation.id)
} }
this.loggerService.log('cleanUpExpiredReservations ending') this.loggerService.debug('cleanUpExpiredReservations ending')
await this.ntfyProvider.sendCronStopNotification( await this.ntfyProvider.sendCronStopNotification(
'cleanUpExpiredReservations', 'cleanUpExpiredReservations',
`Count: ${reservations.length}`, `Count: ${reservations.length}`,

View file

@ -50,7 +50,7 @@ export class WaitingListService {
@Process() @Process()
async processEmail(job: Job<Email>) { async processEmail(job: Job<Email>) {
const { data: email } = job const { data: email } = job
this.loggerService.log('Handling email', { this.loggerService.debug('Handling email', {
id: email.id, id: email.id,
from: email.from, from: email.from,
subject: email.subject, subject: email.subject,
@ -90,7 +90,7 @@ export class WaitingListService {
return return
} }
this.loggerService.log( this.loggerService.debug(
`Found ${reservations.length} reservations on waiting list`, `Found ${reservations.length} reservations on waiting list`,
) )
@ -125,7 +125,7 @@ export class WaitingListService {
private isRelevantEmail(email: Email): boolean { private isRelevantEmail(email: Email): boolean {
if (!EMAIL_SUBJECT_REGEX.test(email.subject)) { if (!EMAIL_SUBJECT_REGEX.test(email.subject)) {
this.loggerService.log('Ignoring email, irrelevant subject', { this.loggerService.debug('Ignoring email, irrelevant subject', {
id: email.id, id: email.id,
subject: email.subject, subject: email.subject,
}) })
@ -133,7 +133,7 @@ export class WaitingListService {
} }
if (EMAIL_ADDRESS !== email.from) { if (EMAIL_ADDRESS !== email.from) {
this.loggerService.log('Ignoring email, irrelevant sender', { this.loggerService.debug('Ignoring email, irrelevant sender', {
id: email.id, id: email.id,
sender: email.from, sender: email.from,
}) })