Guest User

Untitled

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. /*
  2. * Global debug method
  3. * @method debug
  4. * @param type {object} Defines log type (e.g. 'log', 'warn')
  5. * @param obj A string or object, the suject of the log
  6. * @param scope {string} Scope indentifier
  7. *
  8. * Usage: debug('log', 'Hello World!', 'global');
  9. */
  10. var debug = function ( type, obj, scope ) {
  11.  
  12. var a = arguments,
  13. l = a.length,
  14. c = window.console;
  15.  
  16. if ( c ) {
  17.  
  18. switch ( l ) {
  19.  
  20. case 1 :
  21. c.log( a[0] );
  22. break;
  23.  
  24. case 2 :
  25. c[ type ] ?
  26. c[ type ]( obj ) :
  27. c.log( obj );
  28. break;
  29.  
  30. case 3 :
  31. c[ type ] ?
  32. c[ type ]( scope + ': ', obj ) :
  33. c.log( scope + ': ', obj );
  34. break;
  35.  
  36. default :
  37. return false;
  38. break;
  39.  
  40. }
  41.  
  42. }
  43.  
  44. };
Add Comment
Please, Sign In to add comment