forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputLogHandler.php
More file actions
42 lines (36 loc) · 896 Bytes
/
Copy pathOutputLogHandler.php
File metadata and controls
42 lines (36 loc) · 896 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
41
42
<?php
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.
*/
class OutputLogHandler extends AbstractProcessingHandler
{
/**
* @var OutputInterface
*/
protected $output;
/**
* @param OutputInterface $output
* @param bool|string $level
* @param bool $bubble
*/
public function __construct(
OutputInterface $output,
$level = LogLevel::INFO,
$bubble = true
) {
parent::__construct($level, $bubble);
$this->output = $output;
}
/**
* Write a log entry to the terminal.
* @param array $record
*/
protected function write(array $record)
{
$this->output->write((string)$record['formatted']);
}
}