From 1631480d50052aacf8a1dd1fab11a49e018b6bc3 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 19 Nov 2014 12:22:23 +0000 Subject: [PATCH] Use JSNlog (at level INFO) for all logging. --- src/mkws-core.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mkws-core.js b/src/mkws-core.js index c331bc4..8f48dfd 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -16,6 +16,7 @@ window.mkws = { authenticated: false, authenticating: false, active: false, + logger: undefined, log_level: 1, // Will be overridden from mkws.config, but // initial value allows jQuery popup to use logging. teams: {}, @@ -90,14 +91,15 @@ if (typeof(mkws_jQuery) !== "undefined") { mkws.$ = jQuery; } +mkws.logger = JL('mkws'); +var consoleAppender = JL.createConsoleAppender('consoleAppender'); +mkws.logger.setOptions({ "appenders": [consoleAppender]} ); + + mkws.log = function(string) { if (!mkws.log_level) return; - if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */ - return; - } - // you need to disable use strict at the top of the file!!! if (mkws.log_level >= 3) { // Works in Chrome; not sure about elsewhere @@ -105,7 +107,7 @@ mkws.log = function(string) { } else if (mkws.log_level >= 2) { console.log(">>> called from function " + arguments.callee.caller.name + ' <<<'); } - console.log(string); + mkws.logger.info(string); }; -- 1.7.10.4