Add logger module and custom logger implementation

ConsoleLoggerService is based on the default Nest LoggerService, but adds the ability to give context about the function that is logging something. It also removes the `[Nest]` string and the PID at the beginning of each log line.

NestConsoleLoggerService is a wrapper around ConsoleLoggerService and makes it possible to use our implementation as a default Nest LoggerService

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-09-27 21:41:02 +02:00
parent 743eb7469d
commit b256fc8b36
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 161 additions and 0 deletions

View file

@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { ConsoleLoggerService } from './console-logger.service';
import { NestConsoleLoggerService } from './nest-console-logger.service';
@Module({
providers: [ConsoleLoggerService, NestConsoleLoggerService],
exports: [ConsoleLoggerService, NestConsoleLoggerService],
})
export class LoggerModule {}