Updated log4js version.

This commit is contained in:
SamTV12345 2023-06-25 17:50:46 +02:00
parent 06329e1723
commit 1ec3b37eb5

View file

@ -50,15 +50,18 @@ 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: [{type: 'console'}]});
const defaultLogConfig = () => ({appenders: { console: { type: 'console' } },
categories:{
default: { appenders: ['console'], level: 'info'}
}});
const defaultLogLevel = 'INFO';
const initLogging = (logLevel, config) => {
// log4js.configure() modifies exports.logconfig so check for equality first.
const logConfigIsDefault = deepEqual(config, defaultLogConfig());
log4js.configure(config);
log4js.setGlobalLogLevel(logLevel);
log4js.replaceConsole();
log4js.getLogger("console");
console.log = logger.info.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.');
};