Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
OlzCommandOutputLogHandler | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
write | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDefaultFormatter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | /* |
6 | * This file is part of the Monolog package. |
7 | * |
8 | * (c) Jordi Boggiano <j.boggiano@seld.be> |
9 | * |
10 | * For the full copyright and license information, please view the LICENSE |
11 | * file that was distributed with this source code. |
12 | */ |
13 | |
14 | namespace Olz\Command\Common; |
15 | |
16 | use Monolog\Formatter\FormatterInterface; |
17 | use Monolog\Formatter\LineFormatter; |
18 | use Monolog\Handler\AbstractProcessingHandler; |
19 | use Monolog\Level; |
20 | use Monolog\LogRecord; |
21 | use Symfony\Component\Console\Output\OutputInterface; |
22 | |
23 | class OlzCommandOutputLogHandler extends AbstractProcessingHandler { |
24 | private OutputInterface $output; |
25 | |
26 | public function __construct(OutputInterface $output, int|string|Level $level = Level::Debug, bool $bubble = true) { |
27 | $this->output = $output; |
28 | parent::__construct($level, $bubble); |
29 | } |
30 | |
31 | protected function write(LogRecord $record): void { |
32 | $this->output->writeln($record->formatted); |
33 | } |
34 | |
35 | protected function getDefaultFormatter(): FormatterInterface { |
36 | return new LineFormatter("%level_name%: %message%"); |
37 | } |
38 | } |