UPDATE: Added log-lib on more routes and services

This commit is contained in:
rodrigo.zamboni
2022-06-29 14:12:13 -03:00
parent bc0d456c2a
commit a39622bfa1
11 changed files with 222 additions and 132 deletions
+11 -3
View File
@@ -1,15 +1,23 @@
import { Controller, Get } from '@nestjs/common';
import { Controller, Get, Inject } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { HealthService } from './health.service';
import { DadosferaLogger } from 'dadosfera-logs';
@ApiTags('Health')
@Controller('health')
export class HealthController {
constructor(private readonly healthService: HealthService) {}
logger: any;
constructor(
@Inject(DadosferaLogger)
dadosferaLogger: DadosferaLogger,
private readonly healthService: HealthService,
) {
this.logger = dadosferaLogger.logger;
}
@Get()
check() {
console.log(`/health`, 'check');
this.logger.info('/health - check');
return this.healthService.check();
}
}
+10 -2
View File
@@ -1,9 +1,17 @@
import { Injectable } from '@nestjs/common';
import { Inject, Injectable } from '@nestjs/common';
import { DadosferaLogger } from 'dadosfera-logs';
@Injectable()
export class HealthService {
logger: any;
constructor(
@Inject(DadosferaLogger)
dadosferaLogger: DadosferaLogger,
) {
this.logger = dadosferaLogger.logger;
}
check() {
console.log('HEALTH');
this.logger.info('HEALTH');
return { message: 'Ok' };
}
}