-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See https://github.com/silverstripeltd/open-sourcerers/issues/91 * Add `PreformattedEchoHandler` cherry-picked from 4c3f3e6 * 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>
- Loading branch information
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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')); | ||
} | ||
} |