Fix/log4js (#5766)

* Updated log4js

* Updated log4js version.

* Removed requests and moved to axios.

* Fixed startup.

* Fixed windows dependency install.

* Fixed import export rate limiter.

* Fixed all log levels.
This commit is contained in:
SamTV12345 2023-10-22 18:26:58 +02:00 committed by GitHub
parent f64ddd9cb1
commit f649b1e6f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 114 additions and 52 deletions

View file

@ -50,15 +50,24 @@ 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');
// 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.');
};