title: Get Monolog to log to an Array
body: <p>We have an old Application part which does not use Monolog yet. This application needs on one time the whole output from the log so it can print it out in a hidden div visible only for developers.</p>
  <p>Much like live debug...<br />
  The problem is I can't figure out how to get Monolog to log to an array or set the handler for a local variable, or to get the output from the log on a particular part of code.</p>
  <p>This is what I came up with until now:</p>
  <pre><code> protected function getHandlers()
      {
          $handlers = array();
  
          $logsDir = $this-&gt;getLogsDir();
          $logFile = $logsDir . DIRECTORY_SEPARATOR . 'application.log';
  
          $logfileHandler = new \Monolog\Handler\FingersCrossedHandler($logFile, Logger::ERROR);
  
          array_push($handlers, $logfileHandler); 
          
  
          // When in CLI, we're going to push the logs through STDERR as well
          // This way, if needed, we can easily redirect STDERR to STDOUT or to some specified file
          if (php_sapi_name() == 'cli') {
              $stderrHandler = new StreamHandler('php://stderr', Logger::INFO);
              array_push($handlers, $stderrHandler);
          }
  
          return $handlers;
      }
  </code></pre>
  <p>Anyone any idea which handler is suitable for that? (examples are welcome)</p>