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,
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 {

View file

@ -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)
}

View file

@ -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}`,

View file

@ -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}`,

View file

@ -50,7 +50,7 @@ export class WaitingListService {
@Process()
async processEmail(job: Job<Email>) {
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,
})