loglevel helpers
This commit is contained in:
parent
0c155c365e
commit
991fb36011
@ -36,6 +36,10 @@ class LoggerClient {
|
||||
return this.#_logLevel;
|
||||
}
|
||||
|
||||
get logLevels () {
|
||||
return Object.keys(this.#_logLevelMapping);
|
||||
}
|
||||
|
||||
setLogLevel (level = 'info') {
|
||||
if (typeof level === 'number')
|
||||
this.#_logLevel = level;
|
||||
|
@ -54,6 +54,23 @@ class MasterLogger {
|
||||
|
||||
}
|
||||
|
||||
get logLevel () {
|
||||
return this.#_logLevel;
|
||||
}
|
||||
|
||||
get logLevels () {
|
||||
return Object.keys(this.#_logLevelMapping);
|
||||
}
|
||||
|
||||
setLogLevel (level = 'info') {
|
||||
if (typeof level === 'number')
|
||||
this.#_logLevel = level;
|
||||
else if (typeof level === 'string')
|
||||
this.#_logLevel = this.#_logLevelMapping[level.toLowerCase()];
|
||||
else
|
||||
throw new Error(`Invalid log level type, expected string or number, got ${typeof level}`);
|
||||
}
|
||||
|
||||
attach (shard) {
|
||||
shard.on('message', (msg) => {
|
||||
if (!msg[this.#_guard])
|
||||
|
Loading…
Reference in New Issue
Block a user