diff --git a/src/LoggerClient.js b/src/LoggerClient.js index e40d1f2..05aa0cc 100644 --- a/src/LoggerClient.js +++ b/src/LoggerClient.js @@ -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; diff --git a/src/MasterLogger.js b/src/MasterLogger.js index 808d922..3493cdf 100644 --- a/src/MasterLogger.js +++ b/src/MasterLogger.js @@ -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])