From 9332c5eb6c8d65508dce2d35d419ce387a395231 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 10 Jul 2013 15:41:18 +0000 Subject: [PATCH] feature(util) call log with any count of params --- ChangeLog | 2 ++ lib/util.js | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b13448d3..ac71c9e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -102,6 +102,8 @@ getJSONfromFileTable. * chore(dom) jquery: v2.0.0 -> v2.0.3 +* feature(util) call log with any count of params + 2012.04.22, v0.2.0 diff --git a/lib/util.js b/lib/util.js index cb52bb0b..87ccba16 100644 --- a/lib/util.js +++ b/lib/util.js @@ -350,14 +350,22 @@ Util = exports || {}; * function log pArg if it's not empty * @param pArg */ - Util.log = function(pArg){ - var lConsole = Scope.console, - lDate = '[' + Util.getDate() + '] '; + Util.log = function(){ + var lArg = arguments, + lConsole = Scope.console, + lDate = '[' + Util.getDate() + '] ', + + lUnShift = Util.bind([].unshift, lArg), + lShift = Util.bind([].shift, lArg), + lJoin = Util.bind([].join, lArg); - if (lConsole && pArg) - lConsole.log(lDate, pArg); + if (lConsole && lArg.length) { + lUnShift(lDate); + lConsole.log.apply(lConsole, lArg); + lShift(); + } - return pArg; + return lJoin(' '); }; /**