diff --git a/src/lib/utils/loggers.ts b/src/lib/utils/loggers.ts index f5312e0cc..38057d31c 100644 --- a/src/lib/utils/loggers.ts +++ b/src/lib/utils/loggers.ts @@ -24,6 +24,11 @@ export class Logger { */ errorCount = 0; + /** + * How many warning messages have been logged? + */ + warningCount = 0; + /** * Has an error been raised through the log method? */ @@ -31,6 +36,13 @@ export class Logger { return this.errorCount > 0; } + /** + * Has a warning been raised through the log method? + */ + public hasWarnings(): boolean { + return this.warningCount > 0; + } + /** * Reset the error counter. */ @@ -38,6 +50,13 @@ export class Logger { this.errorCount = 0; } + /** + * Reset the warning counter. + */ + public resetWarnings() { + this.warningCount = 0; + } + /** * Log the given message. * @@ -109,6 +128,9 @@ export class Logger { if (level === LogLevel.Error) { this.errorCount += 1; } + if (level === LogLevel.Warn) { + this.warningCount += 1; + } } /**