-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathOutputLogHandler.php
More file actions
40 lines (33 loc) · 882 Bytes
/
Copy pathOutputLogHandler.php
File metadata and controls
40 lines (33 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace PHPCensor\Logging;
use Monolog\Handler\AbstractProcessingHandler;
use Psr\Log\LogLevel;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class OutputLogHandler outputs the build log to the terminal.
*
* @package PHP Censor
* @subpackage Application
*
* @author Dmitry Khomutov <poisoncorpsee@gmail.com>
*/
class OutputLogHandler extends AbstractProcessingHandler
{
protected OutputInterface $output;
public function __construct(
OutputInterface $output,
string $level = LogLevel::INFO,
bool $bubble = true
) {
parent::__construct($level, $bubble);
$this->output = $output;
}
/**
* Write a log entry to the terminal.
*/
protected function write(array $record): void
{
$this->output->write((string)$record['formatted']);
}
}