add health log for services

This commit is contained in:
sbriat 2023-04-04 09:58:17 +02:00
parent 404ac0d61a
commit a8b000d347
5 changed files with 42 additions and 1 deletions

View File

@ -54,6 +54,10 @@ import { AdminApiController } from './logger/adapters/primaries/admin-api.contro
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.username.update.warning',
},
loggingAuthHealthCrit: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.auth.health.crit',
},
loggingConfigurationCreateInfo: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.configuration.create.info',
@ -86,6 +90,10 @@ import { AdminApiController } from './logger/adapters/primaries/admin-api.contro
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.configuration.update.crit',
},
loggingConfigurationHealthCrit: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.configuration.health.crit',
},
loggingTerritoryCreateInfo: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.territory.create.info',
@ -118,6 +126,10 @@ import { AdminApiController } from './logger/adapters/primaries/admin-api.contro
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.territory.update.crit',
},
loggingTerritoryHealthCrit: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.territory.health.crit',
},
loggingUserCreateInfo: {
exchange: configService.get<string>('RMQ_EXCHANGE'),
routingKey: 'logging.user.create.info',

View File

@ -15,7 +15,6 @@ export class AdminApiController {
name: 'loggingAdminApiHealthCrit',
})
public async adminApiHealthCriticalHandler(message: string) {
console.log('ici');
this.logger.configure(
loggerOptions('admin-api', level.crit, 'crit', 'health'),
);

View File

@ -70,4 +70,14 @@ export class AuthController {
);
this.logger.warning(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingAuthHealthCrit',
})
public async authHealthCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('auth', level.crit, 'critical', 'health'),
);
this.logger.crit(JSON.parse(message));
}
}

View File

@ -90,4 +90,14 @@ export class ConfigurationController {
);
this.logger.crit(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingConfigurationHealthCrit',
})
public async configurationHealthCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('configuration', level.crit, 'critical', 'health'),
);
this.logger.crit(JSON.parse(message));
}
}

View File

@ -90,4 +90,14 @@ export class TerritoryController {
);
this.logger.crit(JSON.parse(message));
}
@RabbitSubscribe({
name: 'loggingTerritoryHealthCrit',
})
public async territoryHealthCriticalHandler(message: string) {
this.logger.configure(
loggerOptions('territory', level.crit, 'critical', 'health'),
);
this.logger.crit(JSON.parse(message));
}
}