Class WinstonLoggerFactory

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

Constructors

Methods

  • Created new logger with specific context merge it with global context

    Parameters

    Returns WinstonLogger

    • new logger with context
    class SomeService {
    logger: WinstonLogger;

    constructor(
    @InjectWinstonLoggerFactory() private readonly loggerFactory: WinstonLoggerFactory,
    ) {
    // Create logger for this service
    this.logger = this.loggerFactory.create({
    scope: SomeService.name,
    })
    }