mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Adding a layoutType (#6559)
This will allow end users to change the console output to not output colors
This commit is contained in:
parent
5c71151b80
commit
c8797efaf2
2 changed files with 22 additions and 4 deletions
|
@ -648,6 +648,13 @@
|
||||||
*/
|
*/
|
||||||
"loglevel": "INFO",
|
"loglevel": "INFO",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The log layout type to use.
|
||||||
|
*
|
||||||
|
* Valid values: basic, colored
|
||||||
|
*/
|
||||||
|
"logLayoutType": "colored",
|
||||||
|
|
||||||
/* Override any strings found in locale directories */
|
/* Override any strings found in locale directories */
|
||||||
"customLocaleStrings": {},
|
"customLocaleStrings": {},
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,14 @@ const nonSettings = [
|
||||||
|
|
||||||
// This is a function to make it easy to create a new instance. It is important to not reuse a
|
// 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. :(
|
// config object after passing it to log4js.configure() because that method mutates the object. :(
|
||||||
const defaultLogConfig = (level: string) => ({
|
const defaultLogConfig = (level: string, layoutType: string) => ({
|
||||||
appenders: {console: {type: 'console'}},
|
appenders: {console: {type: 'console', layout: {type: layoutType}}},
|
||||||
categories: {
|
categories: {
|
||||||
default: {appenders: ['console'], level},
|
default: {appenders: ['console'], level},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const defaultLogLevel = 'INFO';
|
const defaultLogLevel = 'INFO';
|
||||||
|
const defaultLogLayoutType = 'colored';
|
||||||
|
|
||||||
const initLogging = (config: any) => {
|
const initLogging = (config: any) => {
|
||||||
// log4js.configure() modifies exports.logconfig so check for equality first.
|
// log4js.configure() modifies exports.logconfig so check for equality first.
|
||||||
|
@ -76,7 +77,7 @@ const initLogging = (config: any) => {
|
||||||
|
|
||||||
// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
|
// Initialize logging as early as possible with reasonable defaults. Logging will be re-initialized
|
||||||
// with the user's chosen log level and logger config after the settings have been loaded.
|
// with the user's chosen log level and logger config after the settings have been loaded.
|
||||||
initLogging(defaultLogConfig(defaultLogLevel));
|
initLogging(defaultLogConfig(defaultLogLevel, defaultLogLayoutType));
|
||||||
|
|
||||||
/* Root path of the installation */
|
/* Root path of the installation */
|
||||||
exports.root = absolutePaths.findEtherpadRoot();
|
exports.root = absolutePaths.findEtherpadRoot();
|
||||||
|
@ -291,6 +292,11 @@ exports.allowUnknownFileEnds = true;
|
||||||
*/
|
*/
|
||||||
exports.loglevel = defaultLogLevel;
|
exports.loglevel = defaultLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The log layout type of log4js
|
||||||
|
*/
|
||||||
|
exports.logLayoutType = defaultLogLayoutType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable IP logging
|
* Disable IP logging
|
||||||
*/
|
*/
|
||||||
|
@ -817,7 +823,12 @@ exports.reloadSettings = () => {
|
||||||
storeSettings(credentials);
|
storeSettings(credentials);
|
||||||
|
|
||||||
// Init logging config
|
// Init logging config
|
||||||
exports.logconfig = defaultLogConfig(exports.loglevel ? exports.loglevel : defaultLogLevel);
|
exports.logconfig = defaultLogConfig(
|
||||||
|
exports.loglevel ? exports.loglevel : defaultLogLevel,
|
||||||
|
exports.logLayoutType ? exports.logLayoutType : defaultLogLayoutType
|
||||||
|
);
|
||||||
|
logger.warn("loglevel: " + exports.loglevel);
|
||||||
|
logger.warn("logLayoutType: " + exports.logLayoutType);
|
||||||
initLogging(exports.logconfig);
|
initLogging(exports.logconfig);
|
||||||
|
|
||||||
if (!exports.skinName) {
|
if (!exports.skinName) {
|
||||||
|
|
Loading…
Reference in a new issue