Is there a way to read console.log using Javascript?

The name is pretty clear.

Is there a way to read everything that was output to console.log until the moment you decide to read it using Javascript?

+6
source share
1 answer

You can create a proxy server around it, for example:

(function(win){ var ncon = win.console; var con = win.console = { backlog: [] }; for(var k in ncon) { if(typeof ncon[k] === 'function') { con[k] = (function(fn) { return function() { con.backlog.push([new Date(), fn, arguments]); ncon[fn].apply(ncon, arguments); }; })(k); } } })(window); 
+6
source

Source: https://habr.com/ru/post/954205/


All Articles