mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
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:
parent
f64ddd9cb1
commit
f649b1e6f7
10 changed files with 114 additions and 52 deletions
|
@ -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.');
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue