mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
fix(config): changed to work in node v4,v5
This commit is contained in:
parent
c1f1cea5a5
commit
b65aef9faf
@ -5,6 +5,12 @@ const levels = require('./levels');
|
||||
const layouts = require('./layouts');
|
||||
const debug = require('debug')('log4js:configuration');
|
||||
|
||||
const validColours = [
|
||||
'white', 'grey', 'black',
|
||||
'blue', 'cyan', 'green',
|
||||
'magenta', 'red', 'yellow'
|
||||
];
|
||||
|
||||
function not(thing) {
|
||||
return !thing;
|
||||
}
|
||||
@ -164,10 +170,8 @@ class Configuration {
|
||||
this.throwExceptionIf(not(anInteger(levelConfig[l].value)), `level "${l}".value must have an integer value`);
|
||||
this.throwExceptionIf(not(levelConfig[l].colour), `level "${l}" must have a 'colour' property`);
|
||||
this.throwExceptionIf(
|
||||
not([
|
||||
'white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'
|
||||
].includes(levelConfig[l].colour)),
|
||||
`level "${l}".colour must be one of white, grey, black, blue, cyan, green, magenta, red, yellow`
|
||||
not(validColours.indexOf(levelConfig[l].colour) > -1),
|
||||
`level "${l}".colour must be one of ${validColours.join(', ')}`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user