From a400ffb90ea4c58ac7505052e00484421d7a4e7b Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 19 Nov 2014 15:39:16 +0000 Subject: [PATCH] Part of MKWS-239. mkws.log() is now a trivial invocation of new underlying private function _log(). Allows us to similarly curry _log() for warn, error, info, etc. --- src/mkws-core.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mkws-core.js b/src/mkws-core.js index 8f48dfd..1d4d26e 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -96,7 +96,7 @@ var consoleAppender = JL.createConsoleAppender('consoleAppender'); mkws.logger.setOptions({ "appenders": [consoleAppender]} ); -mkws.log = function(string) { +function _log(fn, string) { if (!mkws.log_level) return; @@ -105,12 +105,24 @@ mkws.log = function(string) { // Works in Chrome; not sure about elsewhere console.trace(); } else if (mkws.log_level >= 2) { - console.log(">>> called from function " + arguments.callee.caller.name + ' <<<'); + } - mkws.logger.info(string); + fn.call(mkws.logger, string); }; +mkws.log = function(x) { _log(mkws.logger.debug, x) }; +/* +trace("message with severity trace"); +debug("message with severity debug"); +info("message with severity info"); +warn("message with severity warn"); +error("message with severity error"); +fatal("message with severity fatal"); +*/ + + + // Translation function. mkws.M = function(word) { var lang = mkws.config.lang; -- 1.7.10.4