Compare commits
2 Commits
0c155c365e
...
3b3052fd1c
Author | SHA1 | Date | |
---|---|---|---|
3b3052fd1c | |||
991fb36011 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@navy.gif/logger",
|
"name": "@navy.gif/logger",
|
||||||
"version": "1.2.4",
|
"version": "1.2.5",
|
||||||
"description": "Logging thing",
|
"description": "Logging thing",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Navy.gif",
|
"author": "Navy.gif",
|
||||||
|
@ -36,6 +36,10 @@ class LoggerClient {
|
|||||||
return this.#_logLevel;
|
return this.#_logLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get logLevels () {
|
||||||
|
return Object.keys(this.#_logLevelMapping);
|
||||||
|
}
|
||||||
|
|
||||||
setLogLevel (level = 'info') {
|
setLogLevel (level = 'info') {
|
||||||
if (typeof level === 'number')
|
if (typeof level === 'number')
|
||||||
this.#_logLevel = level;
|
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) {
|
attach (shard) {
|
||||||
shard.on('message', (msg) => {
|
shard.on('message', (msg) => {
|
||||||
if (!msg[this.#_guard])
|
if (!msg[this.#_guard])
|
||||||
|
Loading…
Reference in New Issue
Block a user