From: Mike Taylor Date: Thu, 20 Nov 2014 17:00:54 +0000 (+0000) Subject: Set logging level when mkws-core.js is loaded, rather than during init. X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=fd4ce75f596dab0e44fc721daca62503babb2687;p=mkws-moved-to-github.git Set logging level when mkws-core.js is loaded, rather than during init. Allows it to affect logging of widget registrations. --- diff --git a/src/mkws-core.js b/src/mkws-core.js index 19718e8..3087120 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -161,13 +161,6 @@ mkws.promotionFunction = function(name) { mkws.setMkwsConfig = function(overrides) { - // Set global log_level flag early so that _log() works - var tmp = overrides.log_level; - if (typeof(tmp) !== 'undefined') { - console.log("setting level to '" + tmp + "'"); - mkws.logger.setOptions({ "level": mkws.stringToLevel(tmp) }); - } - var config_default = { use_service_proxy: true, pazpar2_url: undefined, @@ -667,4 +660,11 @@ mkws.info("Using window.name '" + window.name + "'"); } }); + // Set global log_level flag early so that _log() works + if (typeof mkws_config !== 'undefined') { + var tmp = mkws_config.log_level; + if (typeof tmp !== 'undefined') { + mkws.logger.setOptions({ "level": mkws.stringToLevel(tmp) }); + } + } })(mkws.$);