Skip to content

Commit

Permalink
fix: Logger extensions now also count the warnings (#1210)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PissedCapslock committed Feb 22, 2020
1 parent 0399e75 commit c4ce9a5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lib/utils/loggers.ts
Expand Up @@ -184,9 +184,7 @@ export class ConsoleLogger extends Logger {
* @param newLine Should the logger print a trailing whitespace?
*/
public log(message: string, level: LogLevel = LogLevel.Info, newLine?: boolean) {
if (level === LogLevel.Error) {
this.errorCount += 1;
}
super.log(message, level, newLine);

let output = '';
if (level === LogLevel.Error) {
Expand Down Expand Up @@ -234,9 +232,7 @@ export class CallbackLogger extends Logger {
* @param newLine Should the logger print a trailing whitespace?
*/
public log(message: string, level: LogLevel = LogLevel.Info, newLine?: boolean) {
if (level === LogLevel.Error) {
this.errorCount += 1;
}
super.log(message, level, newLine);

this.callback(message, level, newLine);
}
Expand Down

0 comments on commit c4ce9a5

Please sign in to comment.