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 n
I created a zero-dependency npm
module for this case: console-events
(surely if you're okay to use nodejs :P)
You can add event listener like that:
const { console } = require('console-events');
console.addEventListener('log', (e) => {
e.preventDefault(); //if you need to prevent normal behaviour e.g. output to devtools console
$('#debugDiv').append('<p>' + message + '</p>');
})