From 267590246807e09ff1625a1b4e1f71aa4d03c712 Mon Sep 17 00:00:00 2001 From: sbriat Date: Mon, 17 Jul 2023 16:37:17 +0200 Subject: [PATCH] read logs --- .../message-controllers/auth.controller.ts | 26 ++++++++++++++++--- src/modules/logger/logger.module.ts | 16 +++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/modules/logger/interface/message-controllers/auth.controller.ts b/src/modules/logger/interface/message-controllers/auth.controller.ts index 3ab6472..f74eaff 100644 --- a/src/modules/logger/interface/message-controllers/auth.controller.ts +++ b/src/modules/logger/interface/message-controllers/auth.controller.ts @@ -32,11 +32,21 @@ export class AuthController { } @RabbitSubscribe({ - name: 'loggingAuthUsernameAddedWarning', + name: 'loggingAuthReadWarning', }) - public async authUsernameAddedWarningHandler(message: string) { + public async authReadWarningHandler(message: string) { this.logger.configure( - loggerOptions('auth', level.warning, 'warning', 'username-added'), + loggerOptions('auth', level.warning, 'warning', 'read'), + ); + this.logger.crit(JSON.parse(message)); + } + + @RabbitSubscribe({ + name: 'loggingAuthUsernameCreatedWarning', + }) + public async authUsernameCreatedWarningHandler(message: string) { + this.logger.configure( + loggerOptions('auth', level.warning, 'warning', 'username-created'), ); this.logger.warning(JSON.parse(message)); } @@ -51,6 +61,16 @@ export class AuthController { this.logger.warning(JSON.parse(message)); } + @RabbitSubscribe({ + name: 'loggingAuthUsernameReadWarning', + }) + public async authUsernameReadWarningHandler(message: string) { + this.logger.configure( + loggerOptions('auth', level.warning, 'warning', 'username-read'), + ); + this.logger.warning(JSON.parse(message)); + } + @RabbitSubscribe({ name: 'loggingAuthPasswordUpdatedWarning', }) diff --git a/src/modules/logger/logger.module.ts b/src/modules/logger/logger.module.ts index 23c2307..e22dfac 100644 --- a/src/modules/logger/logger.module.ts +++ b/src/modules/logger/logger.module.ts @@ -89,16 +89,26 @@ import { AdminApiController } from './interface/message-controllers/admin-api.co routingKey: 'logging.auth.deleted.crit', queue: 'logging-auth-deleted-crit', }, - loggingAuthUsernameAddedWarning: { + loggingAuthReadWarning: { exchange: configService.get('RMQ_EXCHANGE'), - routingKey: 'logging.auth.username.added.warning', - queue: 'logging-auth-username-added-warning', + routingKey: 'logging.auth.read.warning', + queue: 'logging-auth-read-warning', + }, + loggingAuthUsernameCreatedWarning: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: 'logging.auth.username.created.warning', + queue: 'logging-auth-username-created-warning', }, loggingAuthUsernameDeletedWarning: { exchange: configService.get('RMQ_EXCHANGE'), routingKey: 'logging.auth.username.deleted.warning', queue: 'logging-auth-username-deleted-warning', }, + loggingAuthUsernameReadWarning: { + exchange: configService.get('RMQ_EXCHANGE'), + routingKey: 'logging.auth.username.read.warning', + queue: 'logging-auth-username-read-warning', + }, loggingAuthPasswordUpdatedWarning: { exchange: configService.get('RMQ_EXCHANGE'), routingKey: 'logging.auth.password.updated.warning',