title: How to get all the console.logs using javascript
body: <p>How can i get all the console logs logged by my web app?
  Is there anything like console.getAllLogs() that can return array or object of all the logs printed?</p>
  
  <p>I tried to store all the logs in an array using <code>window.onerror</code></p>
  
  <pre><code>// i used something like this, but i want to get logs whenever i want
  window.onerror = function(message, file, line) {
    console.log('An error occured at line ' + line + ' of ' + file + ': ' + message);
  };
  </code></pre>