From 82f747fbab18e2ab6a049ba558c42f0a0b040414 Mon Sep 17 00:00:00 2001 From: sbriat Date: Mon, 3 Apr 2023 14:34:14 +0200 Subject: [PATCH] user service health --- src/modules/logger.module.ts | 4 ++++ .../logger/adapters/primaries/user.controller.ts | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/modules/logger.module.ts b/src/modules/logger.module.ts index c57df59..ceea287 100644 --- a/src/modules/logger.module.ts +++ b/src/modules/logger.module.ts @@ -150,6 +150,10 @@ import { AdminApiController } from './logger/adapters/primaries/admin-api.contro exchange: configService.get('RMQ_EXCHANGE'), routingKey: 'logging.user.update.crit', }, + loggingUserHealthCrit: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: 'logging.user.health.crit', + }, }, uri: configService.get('RMQ_URI'), connectionInitOptions: { wait: false }, diff --git a/src/modules/logger/adapters/primaries/user.controller.ts b/src/modules/logger/adapters/primaries/user.controller.ts index d33e1df..d10abd9 100644 --- a/src/modules/logger/adapters/primaries/user.controller.ts +++ b/src/modules/logger/adapters/primaries/user.controller.ts @@ -84,4 +84,14 @@ export class UserController { ); this.logger.crit(JSON.parse(message)); } + + @RabbitSubscribe({ + name: 'loggingUserHealthCrit', + }) + public async userHealthCriticalHandler(message: string) { + this.logger.configure( + loggerOptions('user', level.crit, 'critical', 'health'), + ); + this.logger.crit(JSON.parse(message)); + } }