diff --git a/lib/configuration.js b/lib/configuration.js index 668adaa..28b685b 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -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(', ')}` ); }); }