reading the firebug console in javascript

后端 未结 5 580
春和景丽
春和景丽 2020-12-19 16:37

I\'m looking for a way to read the most recent command that was logged to the firebug console.

For example, I could have something that does

console.         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 17:17

    Don't try and override console.debug, implement a function that does console.debug plus what you need.

    var debugCalls = [ ];
    function myDebug(errorMessage){
      console.debug(errorMessage); //maintain original functionality
      debugCalls[debugCalls.length]  = errorMessage;
      //the previous argument to myDebug is debugCalls[debugCalls.length]
    
      //you may also want to call an ajax function to report this error
      mailError(errorMessage);
    }
    

提交回复
热议问题