feature(util) call log with any count of params

This commit is contained in:
coderaiser 2013-07-10 15:41:18 +00:00
parent c7670fbb36
commit 9332c5eb6c
2 changed files with 16 additions and 6 deletions

View file

@ -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

View file

@ -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(' ');
};
/**