#Why docs using new keyword instead of DI?

4 messages · Page 1 of 1 (latest)

topaz monolith
#

Just came across the docs https://docs.nestjs.com/techniques/logger#using-the-logger-for-application-logging

private readonly logger = new Logger(MyService.name);

I wonder why it is using new instead of constructor injection in that case?

tulip saffron
#

this is because Logger isn't injectable

topaz monolith
#

@tulip saffron ho I see, this requites a boilerplate.... however I've assume Loggier is injectable by default....