nest-custom-logger
v1.0.8
Published
Custom logger for nestJs
Downloads
17
Readme
nest-custom-logger
nest-custom-logger is a logger library for filtering sensitive data in logs.
Installation
Use the package manager npm to install the library.
npm install nest-custom-logger
Usage
Add CustomLoggerModule to Your module
import { CustomLoggerModule } from 'nest-custom-logger';
@Module({
imports: [
CustomLoggerModule
],
})
export class MyModule {}
Inject the logger in your service
import { Logger } from '@nestjs/common';
export class MyService{
constructor(private readonly logger: Logger){
this.logger.setContext(MyService.name)
}
}
Use @isLoggerInjected() decorator in your service to ensure that only injected logger is permissable.
@isLoggerInjected()
export class MyService{}