Skip to content

Commit

Permalink
fix: prevent logging loop
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Apr 19, 2023
1 parent c17a69f commit 55bcbc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,10 @@ export class Logger {
*/
public fatal(...args: unknown[]): Logger {
// always show fatal to stderr
// eslint-disable-next-line no-console
console.error(...args);
// IMPORTANT:
// Do not use console.error() here, if fatal() is called from the uncaughtException handler, it
// will be re-thrown and caught again by the uncaughtException handler, causing an infinite loop.
console.log(...args); // eslint-disable-line no-console
this.bunyan.fatal(this.applyFilters(LoggerLevel.FATAL, ...args));
return this;
}
Expand Down

0 comments on commit 55bcbc3

Please sign in to comment.