Posted By

psradich111 on 08/20/11


Tagged

debug console log


Versions (?)

Console.log function with error detection and debug mode


 / Published in: JavaScript
 

will not fail if no console is detected (IE). Debug set o false will disable console output

  1. var debug = true;
  2. var log = function(msg) { if(debug) {try { if (console != null && console.log != null && debug != false) { console.log(msg); } } catch (e) { } } }
  3.  
  4. //Usage log("message");

Report this snippet  

You need to login to post a comment.