Completed
Push — master ( fe927f...32a670 )
by Robbie
21:23 queued 12:16
created

PreformattedEchoHandler::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Logging;
4
5
use Monolog\Handler\AbstractProcessingHandler;
6
7
/**
8
 * Echo the output as preformatted HTML, emulating console output in a browser.
9
 * Tiding us over until we can properly decoupled web from CLI output.
10
 * Do not use this API outside of core modules,
11
 * it'll likely be removed as part of a larger refactor.
12
 *
13
 * See https://github.com/silverstripe/silverstripe-framework/issues/5542
14
 *
15
 * @internal
16
 */
17
class PreformattedEchoHandler extends AbstractProcessingHandler
18
{
19
20
    /**
21
     * @param array $record
22
     */
23
    protected function write(array $record)
24
    {
25
        echo sprintf('<pre>%s</pre>', htmlspecialchars($record['formatted'], ENT_QUOTES, 'UTF-8'));
26
    }
27
}
28