Fixed setLogLevel to affect global logging.

This commit is contained in:
Richard Moore 2020-02-25 14:51:04 -05:00
parent f61f34bfb2
commit ac51a88c29
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -151,15 +151,6 @@ export class Logger {
}); });
} }
setLogLevel(logLevel: LogLevel): void {
const level = LogLevels[logLevel];
if (level == null) {
this.warn("invalid log level - " + logLevel);
return;
}
LogLevel = level;
}
_log(logLevel: LogLevel, args: Array<any>): void { _log(logLevel: LogLevel, args: Array<any>): void {
if (LogLevel > LogLevels[logLevel]) { return; } if (LogLevel > LogLevels[logLevel]) { return; }
console.log.apply(console, args); console.log.apply(console, args);
@ -318,4 +309,13 @@ export class Logger {
_censorErrors = !!censorship; _censorErrors = !!censorship;
_permanentCensorErrors = !!permanent; _permanentCensorErrors = !!permanent;
} }
static setLogLevel(logLevel: LogLevel): void {
const level = LogLevels[logLevel];
if (level == null) {
Logger.globalLogger().warn("invalid log level - " + logLevel);
return;
}
LogLevel = level;
}
} }