Created
March 27, 2012 06:34
-
-
Save ptquang86/2213329 to your computer and use it in GitHub Desktop.
Titanium - Log info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
log info | |
usage: log(1,'hehe', { name: 'test' }) | |
*/ | |
function log() { | |
var arr = []; | |
for(var i = 0, ii = arguments.length; i < ii; i++){ | |
switch(typeof(arguments[i])) { | |
case 'array': case 'object': | |
arr.push( JSON.stringify(arguments[i]) ); | |
break; | |
case 'boolean': | |
arr.push( arguments[i] ? 'true' : 'false' ); | |
break; | |
default: | |
arr.push( arguments[i] ); | |
break; | |
} | |
} | |
Ti.API.debug('----------------------- \n' + arr.join('\n')); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment