Adding some logs for ntfy module

This commit is contained in:
Collin Duncan 2024-09-19 12:51:21 +02:00
parent 6dd515e8eb
commit 2c6e275f4c
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View file

@ -37,6 +37,10 @@ export class NtfyClient {
...message,
}),
)
this.loggerService.debug('Published ntfy-cation', {
topic: this.topic,
message,
})
} catch (error: unknown) {
this.loggerService.error('ntfy client failed', { error })
}

View file

@ -4,6 +4,7 @@ import { ConfigService } from '@nestjs/config'
import { Job, JobOptions, Queue } from 'bull'
import { Dayjs } from 'dayjs'
import { LoggerService } from '../logger/service.logger'
import { NtfyClient } from './client'
import {
MessageConfig,
@ -22,6 +23,9 @@ export class NtfyProvider implements OnApplicationBootstrap {
@Inject(NtfyClient)
private readonly ntfyClient: NtfyClient,
@Inject(LoggerService)
private readonly loggerService: LoggerService,
@InjectQueue(NTFY_PUBLISH_QUEUE_NAME)
private readonly publishQueue: Queue,
) {}
@ -32,6 +36,7 @@ export class NtfyProvider implements OnApplicationBootstrap {
@Process()
async handlePublishJob(job: Job<Omit<MessageConfig, 'topic'>>) {
this.loggerService.debug('Handling publish job', { data: job.data })
await this.ntfyClient.publish({
...job.data,
})