From 16179b08021334cfab02a9dcba8d7f4bd219bc5e Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 29 Nov 2013 13:17:08 -0800 Subject: [PATCH] fix(config): apply CLI logger options as soon as we can We use logging even before parsing the config file - for instance to show the path of the config file that is actually being loaded. At that time, we can't configure the logger based on the config file, but we can already apply the command line arguments. --- lib/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/server.js b/lib/server.js index b558b5227..ae23764e1 100644 --- a/lib/server.js +++ b/lib/server.js @@ -218,8 +218,9 @@ var createSocketIoServer = function(webServer, executor, config) { exports.start = function(cliOptions, done) { - // apply the default logger config as soon as we can - logger.setup(constant.LOG_INFO, true, [constant.CONSOLE_APPENDER]); + // apply the default logger config (and config from CLI) as soon as we can + logger.setup(cliOptions.logLevel || constant.LOG_INFO, + helper.isDefined(cliOptions.colors) ? cliOptions.colors : true, [constant.CONSOLE_APPENDER]); var config = cfg.parseConfig(cliOptions.configFile, cliOptions); var modules = [{