mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(util) call log with any count of params
This commit is contained in:
parent
c7670fbb36
commit
9332c5eb6c
2 changed files with 16 additions and 6 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
20
lib/util.js
20
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(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue