gateway api logs
This commit is contained in:
parent
536cca06c3
commit
fb116d4b0e
|
@ -7,6 +7,7 @@ import * as winston from 'winston';
|
|||
import { AuthController } from './logger/adapters/primaries/auth.controller';
|
||||
import { ConfigurationController } from './logger/adapters/primaries/configuration.controller';
|
||||
import { TerritoryController } from './logger/adapters/primaries/territory.controller';
|
||||
import { GatewayApiController } from './logger/adapters/primaries/gateway-api.controller';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -20,6 +21,10 @@ import { TerritoryController } from './logger/adapters/primaries/territory.contr
|
|||
},
|
||||
],
|
||||
handlers: {
|
||||
loggingGatewayApiHealthCrit: {
|
||||
exchange: configService.get<string>('RMQ_EXCHANGE'),
|
||||
routingKey: 'logging.gateway-api.health.crit',
|
||||
},
|
||||
loggingAuthCreateCrit: {
|
||||
exchange: configService.get<string>('RMQ_EXCHANGE'),
|
||||
routingKey: 'logging.auth.create.crit',
|
||||
|
@ -157,6 +162,7 @@ import { TerritoryController } from './logger/adapters/primaries/territory.contr
|
|||
UserController,
|
||||
ConfigurationController,
|
||||
TerritoryController,
|
||||
GatewayApiController,
|
||||
],
|
||||
providers: [],
|
||||
exports: [],
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { RabbitSubscribe } from '@golevelup/nestjs-rabbitmq';
|
||||
import { Controller, Inject } from '@nestjs/common';
|
||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||
import { Logger } from 'winston';
|
||||
import { level } from './logger/level.enum';
|
||||
import loggerOptions from './logger/logger';
|
||||
|
||||
@Controller()
|
||||
export class GatewayApiController {
|
||||
constructor(
|
||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||
) {}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingGatewayApiHealthCrit',
|
||||
})
|
||||
public async gatewayApiHealthCriticalHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('gateway-api', level.crit, 'crit', 'health'),
|
||||
);
|
||||
this.logger.crit(JSON.parse(message));
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ import * as winston from 'winston';
|
|||
import { level as levelEnum } from './level.enum';
|
||||
|
||||
export class TransportOptions {
|
||||
extension = '.log';
|
||||
extension = '.json';
|
||||
maxSize = '1m';
|
||||
maxFiles = '60';
|
||||
zippedArchive = true;
|
||||
|
|
Loading…
Reference in New Issue