Winston logger factory for creating loggers with predefined context Factory is singleton, so it keep original winston Logger instance and is can be injected to any service
Logger
Created new logger with specific context merge it with global context
specific action with scope, and other data
class SomeService { logger: WinstonLogger; constructor( @InjectWinstonLoggerFactory() private readonly loggerFactory: WinstonLoggerFactory,) { // Create logger for this service this.logger = this.loggerFactory.create({ scope: SomeService.name, })} Copy
class SomeService { logger: WinstonLogger; constructor( @InjectWinstonLoggerFactory() private readonly loggerFactory: WinstonLoggerFactory,) { // Create logger for this service this.logger = this.loggerFactory.create({ scope: SomeService.name, })}
Winston logger factory for creating loggers with predefined context Factory is singleton, so it keep original winston
Logger
instance and is can be injected to any service