Merge branch 'readLogs' into 'main'

read logs

See merge request v3/service/logger!21
This commit is contained in:
Sylvain Briat 2023-07-17 14:39:03 +00:00
commit 9a8683aa9d
2 changed files with 36 additions and 6 deletions

View File

@ -32,11 +32,21 @@ export class AuthController {
} }
@RabbitSubscribe({ @RabbitSubscribe({
name: 'loggingAuthUsernameAddedWarning', name: 'loggingAuthReadWarning',
}) })
public async authUsernameAddedWarningHandler(message: string) { public async authReadWarningHandler(message: string) {
this.logger.configure( 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)); this.logger.warning(JSON.parse(message));
} }
@ -51,6 +61,16 @@ export class AuthController {
this.logger.warning(JSON.parse(message)); 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({ @RabbitSubscribe({
name: 'loggingAuthPasswordUpdatedWarning', name: 'loggingAuthPasswordUpdatedWarning',
}) })

View File

@ -89,16 +89,26 @@ import { AdminApiController } from './interface/message-controllers/admin-api.co
routingKey: 'logging.auth.deleted.crit', routingKey: 'logging.auth.deleted.crit',
queue: 'logging-auth-deleted-crit', queue: 'logging-auth-deleted-crit',
}, },
loggingAuthUsernameAddedWarning: { loggingAuthReadWarning: {
exchange: configService.get<string>('RMQ_EXCHANGE'), exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.username.added.warning', routingKey: 'logging.auth.read.warning',
queue: 'logging-auth-username-added-warning', queue: 'logging-auth-read-warning',
},
loggingAuthUsernameCreatedWarning: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.username.created.warning',
queue: 'logging-auth-username-created-warning',
}, },
loggingAuthUsernameDeletedWarning: { loggingAuthUsernameDeletedWarning: {
exchange: configService.get<string>('RMQ_EXCHANGE'), exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.username.deleted.warning', routingKey: 'logging.auth.username.deleted.warning',
queue: 'logging-auth-username-deleted-warning', queue: 'logging-auth-username-deleted-warning',
}, },
loggingAuthUsernameReadWarning: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.username.read.warning',
queue: 'logging-auth-username-read-warning',
},
loggingAuthPasswordUpdatedWarning: { loggingAuthPasswordUpdatedWarning: {
exchange: configService.get<string>('RMQ_EXCHANGE'), exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.password.updated.warning', routingKey: 'logging.auth.password.updated.warning',