Skip to content

Commit

Permalink
fix: missing setContext when using logger: false
Browse files Browse the repository at this point in the history
HealthIndicator assumes it gets a ConsoleLogger, but TERMINUS_LOGGER is only
guaranteed to be an instance of LoggerService which doesn't have a setContext
method. This breaks when using logger: false.
  • Loading branch information
Mikael Langer committed Mar 20, 2023
1 parent 3472d86 commit 9274056
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/health-indicator/http/http.health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class HttpHealthIndicator extends HealthIndicator {
private readonly logger: ConsoleLogger,
) {
super();
this.logger.setContext(HttpHealthIndicator.name);
if (this.logger instanceof ConsoleLogger) {
this.logger.setContext(HttpHealthIndicator.name);
}
this.checkDependantPackages();
}

Expand Down

0 comments on commit 9274056

Please sign in to comment.