Skip to content

Commit c4ce9a5

Browse files
fix: Logger extensions now also count the warnings (#1210)
I cannot believe I messed up that previous PR (#1205), but the extensions of the `Logger` class did not count the warnings. Solved this by removing the error counting code from the child classes, and called the super method instead. This ensures that both the error count and the warning count increases.
1 parent 0399e75 commit c4ce9a5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/lib/utils/loggers.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ export class ConsoleLogger extends Logger {
184184
* @param newLine Should the logger print a trailing whitespace?
185185
*/
186186
public log(message: string, level: LogLevel = LogLevel.Info, newLine?: boolean) {
187-
if (level === LogLevel.Error) {
188-
this.errorCount += 1;
189-
}
187+
super.log(message, level, newLine);
190188

191189
let output = '';
192190
if (level === LogLevel.Error) {
@@ -234,9 +232,7 @@ export class CallbackLogger extends Logger {
234232
* @param newLine Should the logger print a trailing whitespace?
235233
*/
236234
public log(message: string, level: LogLevel = LogLevel.Info, newLine?: boolean) {
237-
if (level === LogLevel.Error) {
238-
this.errorCount += 1;
239-
}
235+
super.log(message, level, newLine);
240236

241237
this.callback(message, level, newLine);
242238
}

0 commit comments

Comments
 (0)