Skip to content

Commit

Permalink
add fatal to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpaterson committed Dec 6, 2024
1 parent 5c087db commit 8c4a7d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/util/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface LogHandler {
info(msg?: string, args?: string[]): void;
warn(msg?: string, args?: string[]): void;
error(msg?: string, args?: string[]): void;
fatal(msg?: string, args?: string[]): void;
}

export class ConsoleLogHandler implements LogHandler {
Expand Down Expand Up @@ -69,9 +70,16 @@ export class ConsoleLogHandler implements LogHandler {
console.warn(msg, args);
}
}

error(msg?: string, args?: string[]): void {
if (this.#level >= LOG_LEVELS.ERROR) {
console.error(msg, args);
}
}

fatal(msg?: string, args?: string[]): void {
if (this.#level >= LOG_LEVELS.FATAL) {
console.error(msg, args);
}
}
}

0 comments on commit 8c4a7d1

Please sign in to comment.