Closed dg-eparizzi closed 2 years ago
context
is ignored if you've already specified the context in the logger constructor (new Logger(AppService.name)
- it will work as expected once you remove the AppService.name
part).
This is the expected behavior.
Is there an existing issue for this?
Current behavior
The default
LoggerService
implementation provides the following method signature, apparently to override the context:But when calling something like
this.logger.log("Hello World!", "AppService:getHello")
this results in 2 different log lines:Minimum reproduction code
https://stackblitz.com/edit/nestjs-starter-uecpmz?file=src/app.service.ts
Steps to reproduce
No response
Expected behavior
It's my understanding that the
context
argument would allow one to override the context for this particular log.So calling
this.logger.log("Hello World!", "AppService:getHello")
should output a single log:Package
Other package
No response
NestJS version
8.4.0
Packages versions
Node.js version
14.19.0
In which operating systems have you tested?
Other
No response