mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
log4js: Deprecate the logconfig
setting
This will make it possible to upgrade log4js in a future version.
This commit is contained in:
parent
b3b6c94b76
commit
aec619cc0b
5 changed files with 7 additions and 104 deletions
|
@ -28,6 +28,7 @@
|
|||
*/
|
||||
|
||||
const absolutePaths = require('./AbsolutePaths');
|
||||
const deepEqual = require('fast-deep-equal/es6');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
@ -47,9 +48,13 @@ const defaultLogConfig = () => ({appenders: [{type: 'console'}]});
|
|||
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();
|
||||
// Log the warning after configuring log4js to increase the chances the user will see it.
|
||||
if (!logConfigIsDefault) logger.warn('The logconfig setting is deprecated.');
|
||||
};
|
||||
|
||||
// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue