From 127bc40ba61fc43560fa8c381263d16ff6e64be1 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 11 Aug 2023 22:02:43 +0300 Subject: [PATCH] actually use error stream for errors --- src/MasterLogger.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MasterLogger.ts b/src/MasterLogger.ts index 252f365..9f3dba9 100644 --- a/src/MasterLogger.ts +++ b/src/MasterLogger.ts @@ -222,9 +222,14 @@ class MasterLogger implements Logger const maxChars = Math.max(...this.#types.map(t => t.length)); const spacer = ' '.repeat(maxChars - type.length); - if (this.#_logLevelMapping[type] >= this.#_logLevel) - console.log(`${colour.func(type)}${spacer} ${colour.func(header)}: ${chalk.bold(subheader)}${text}`); // eslint-disable-line no-console - + if (this.#_logLevelMapping[type] >= this.#_logLevel) + { + const out = `${colour.func(type)}${spacer} ${colour.func(header)}: ${chalk.bold(subheader)}${text}`; + if (type === 'error') + console.error(out); // eslint-disable-line no-console + else + console.log(out); // eslint-disable-line no-console + } if ((broadcast || this.#_broadcastLevel <= this.#_logLevelMapping[type]) && this.#webhook) { const description = (subheader.length ? `**${subheader}**\n` : '') + `\`\`\`${text}\`\`\``;