mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
2bcf8b5ff3
See https://github.com/silverstripeltd/open-sourcerers/issues/91 * Add `PreformattedEchoHandler` cherry-picked from 4c3f3e6bea99b46b689e5b23d1bd1498a4ac696c * Batch log messages for every 100 file. Also make logger work for stdout * Update src/Logging/PreformattedEchoHandler.php Co-Authored-By: bergice <bergice@users.noreply.github.com>
28 lines
714 B
PHP
28 lines
714 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Logging;
|
|
|
|
use Monolog\Handler\AbstractProcessingHandler;
|
|
|
|
/**
|
|
* Echo the output as preformatted HTML, emulating console output in a browser.
|
|
* Tiding us over until we can properly decoupled web from CLI output.
|
|
* Do not use this API outside of core modules,
|
|
* it'll likely be removed as part of a larger refactor.
|
|
*
|
|
* See https://github.com/silverstripe/silverstripe-framework/issues/5542
|
|
*
|
|
* @internal
|
|
*/
|
|
class PreformattedEchoHandler extends AbstractProcessingHandler
|
|
{
|
|
|
|
/**
|
|
* @param array $record
|
|
*/
|
|
protected function write(array $record)
|
|
{
|
|
echo sprintf('<pre>%s</pre>', htmlspecialchars($record['formatted'], ENT_QUOTES, 'UTF-8'));
|
|
}
|
|
}
|