mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
improve InternalConsole
This commit is contained in:
parent
75f364d52e
commit
c823b81dda
@ -1,37 +1,36 @@
|
||||
module.exports = class InternalConsole {
|
||||
static log = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.log(...args)
|
||||
constructor(params = {}) {
|
||||
this.params = params
|
||||
}
|
||||
|
||||
exec = (type, ...args) => {
|
||||
if (global.consoleSilent) {
|
||||
return false
|
||||
}
|
||||
|
||||
// fix unsupported types
|
||||
switch (type) {
|
||||
case "table": {
|
||||
return console.table(...args)
|
||||
}
|
||||
}
|
||||
|
||||
static error = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.error(...args)
|
||||
}
|
||||
if (this.params.server_name) {
|
||||
args.unshift(`[${this.params.server_name}]`)
|
||||
}
|
||||
|
||||
static warn = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.warn(...args)
|
||||
}
|
||||
return console[type](...args)
|
||||
}
|
||||
|
||||
static info = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.info(...args)
|
||||
}
|
||||
}
|
||||
log = (...args) => this.exec("log", ...args)
|
||||
|
||||
static debug = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.debug(...args)
|
||||
}
|
||||
}
|
||||
error = (...args) => this.exec("error", ...args)
|
||||
|
||||
static table = (...args) => {
|
||||
if (!global.consoleSilent) {
|
||||
console.table(...args)
|
||||
}
|
||||
}
|
||||
warn = (...args) => this.exec("warn", ...args)
|
||||
|
||||
info = (...args) => this.exec("info", ...args)
|
||||
|
||||
debug = (...args) => this.exec("debug", ...args)
|
||||
|
||||
table = (...args) => this.exec("table", ...args)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user