Logger Servis
Modül, LoggerService export eder. Seçilen sağlayıcıya göre konsola, dosyaya veya MongoDB’ye yazar.
Metodlar
| Metod | Not |
|---|---|
log(message, context?) | Bilgi |
debug(message, context?) | Debug |
warn(message, context?) | Uyarı |
error(message, stack?, context?) | Hata |
fatal(message, stack?, context?) | Kritik |
verbose(message, context?) | Ayrıntı |
Örnek
example.service.ts
import { Injectable } from '@nestjs/common';
import { LoggerService } from 'nestjs-logger-module';
@Injectable()
export class ExampleService {
constructor(private readonly logger: LoggerService) {}
doWork() {
this.logger.log('Hello');
this.logger.debug({ step: 1 }, 'ExampleService');
}
}