Posted By

danielz on 08/30/10


Tagged

console log


Versions (?)

trace


 / Published in: JavaScript
 

Provides a global trace() function similar to that in actionscript that gracefully fails if the browser does not support console.log()

  1. //Browser compatible console.log statement
  2. function trace() {
  3. if (trace.enabled) {
  4. console.log.apply(console, arguments);
  5. } else if (!trace.enablechecked) {
  6. trace.enablechecked = true;
  7. if (typeof(console) != "undefined") {
  8. if (typeof(console.log) == "function") {
  9. trace.enabled = true;
  10. trace.apply(this, arguments)
  11. }
  12. }
  13. }
  14. }

Report this snippet  

You need to login to post a comment.