Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  61] [ 3]  / answers: 1 / hits: 57656  / 13 Years ago, wed, july 6, 2011, 12:00:00

I'm building a debugging tool for my web app and I need to show console errors in a div. I know I can use my own made console like object and use it, but for future use I need to send all console errors to window. Actually I want to catch console events.


More From » browser

 Answers
18

To keep the console working:



if (typeof console  != undefined) 
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function() {};

console.log = function(message) {
console.olog(message);
$('#debugDiv').append('<p>' + message + '</p>');
};
console.error = console.debug = console.info = console.log

[#91320] Tuesday, July 5, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
christianu

Total Points: 481
Total Questions: 124
Total Answers: 99

Location: Trinidad and Tobago
Member since Thu, Dec 1, 2022
2 Years ago
christianu questions
;