Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Global debug method
- * @method debug
- * @param type {object} Defines log type (e.g. 'log', 'warn')
- * @param obj A string or object, the suject of the log
- * @param scope {string} Scope indentifier
- *
- * Usage: debug('log', 'Hello World!', 'global');
- */
- var debug = function ( type, obj, scope ) {
- var a = arguments,
- l = a.length,
- c = window.console;
- if ( c ) {
- switch ( l ) {
- case 1 :
- c.log( a[0] );
- break;
- case 2 :
- c[ type ] ?
- c[ type ]( obj ) :
- c.log( obj );
- break;
- case 3 :
- c[ type ] ?
- c[ type ]( scope + ': ', obj ) :
- c.log( scope + ': ', obj );
- break;
- default :
- return false;
- break;
- }
- }
- };
Add Comment
Please, Sign In to add comment