From 188d58607c0a891f7f0092c391cdf42588f719d3 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Sun, 22 Oct 2023 18:24:04 +0200 Subject: [PATCH] Fixed all log levels. --- src/node/utils/Settings.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index f507bce6963..c9a85daea33 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -50,9 +50,9 @@ const nonSettings = [ // This is a function to make it easy to create a new instance. It is important to not reuse a // config object after passing it to log4js.configure() because that method mutates the object. :( -const defaultLogConfig = () => ({appenders: { console: { type: 'console' } }, - categories:{ - default: { appenders: ['console'], level: 'info'} +const defaultLogConfig = () => ({appenders: {console: {type: 'console'}}, + categories: { + default: {appenders: ['console'], level: 'info'}, }}); const defaultLogLevel = 'INFO'; @@ -60,8 +60,14 @@ const initLogging = (logLevel, config) => { // log4js.configure() modifies exports.logconfig so check for equality first. const logConfigIsDefault = deepEqual(config, defaultLogConfig()); log4js.configure(config); - log4js.getLogger("console"); - console.log = logger.info.bind(logger) + log4js.getLogger('console'); + + // Overwrites for console output methods + console.debug = logger.debug.bind(logger); + console.log = logger.info.bind(logger); + console.warn = logger.warn.bind(logger); + console.error = logger.error.bind(logger); + // Log the warning after configuring log4js to increase the chances the user will see it. if (!logConfigIsDefault) logger.warn('The logconfig setting is deprecated.'); };