Adding some logs for ntfy module
This commit is contained in:
parent
6dd515e8eb
commit
2c6e275f4c
2 changed files with 9 additions and 0 deletions
|
|
@ -37,6 +37,10 @@ export class NtfyClient {
|
||||||
...message,
|
...message,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
this.loggerService.debug('Published ntfy-cation', {
|
||||||
|
topic: this.topic,
|
||||||
|
message,
|
||||||
|
})
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
this.loggerService.error('ntfy client failed', { error })
|
this.loggerService.error('ntfy client failed', { error })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { ConfigService } from '@nestjs/config'
|
||||||
import { Job, JobOptions, Queue } from 'bull'
|
import { Job, JobOptions, Queue } from 'bull'
|
||||||
import { Dayjs } from 'dayjs'
|
import { Dayjs } from 'dayjs'
|
||||||
|
|
||||||
|
import { LoggerService } from '../logger/service.logger'
|
||||||
import { NtfyClient } from './client'
|
import { NtfyClient } from './client'
|
||||||
import {
|
import {
|
||||||
MessageConfig,
|
MessageConfig,
|
||||||
|
|
@ -22,6 +23,9 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
||||||
@Inject(NtfyClient)
|
@Inject(NtfyClient)
|
||||||
private readonly ntfyClient: NtfyClient,
|
private readonly ntfyClient: NtfyClient,
|
||||||
|
|
||||||
|
@Inject(LoggerService)
|
||||||
|
private readonly loggerService: LoggerService,
|
||||||
|
|
||||||
@InjectQueue(NTFY_PUBLISH_QUEUE_NAME)
|
@InjectQueue(NTFY_PUBLISH_QUEUE_NAME)
|
||||||
private readonly publishQueue: Queue,
|
private readonly publishQueue: Queue,
|
||||||
) {}
|
) {}
|
||||||
|
|
@ -32,6 +36,7 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
||||||
|
|
||||||
@Process()
|
@Process()
|
||||||
async handlePublishJob(job: Job<Omit<MessageConfig, 'topic'>>) {
|
async handlePublishJob(job: Job<Omit<MessageConfig, 'topic'>>) {
|
||||||
|
this.loggerService.debug('Handling publish job', { data: job.data })
|
||||||
await this.ntfyClient.publish({
|
await this.ntfyClient.publish({
|
||||||
...job.data,
|
...job.data,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue