JSFiddle - React, Tailwind, and code Playground

JavaScript

var _log = window.console ? 
               window.console.log : function(){};

    _log.history = [];

    console.log = function( ){
        
      var args = Array.prototype.slice.call( arguments );
      _log.history.push.apply( _log.history, args );
      _log.apply( window.console, args );
        
      //OMG custom logic, note forEach is newish dont use in old browsers
      args.forEach(function( n, i ){
          
          document.write( 
              '<pre class="code">' + 
              JSON.stringify( n, undefined, 2 ) +
              '</pre>' );
      });
    }
        
    //Example usage
    console.log({ 
      complex: 'data', 
      object: { 
        neato: [1,2,3,4]
      }
    });

    //What's in the history now use native console.log
    _log.call( console, _log.history );