2013-10-26 17:11:46 +02:00
|
|
|
<?php
|
|
|
|
|
2013-12-13 17:10:54 +01:00
|
|
|
namespace PHPCI\Logging;
|
2013-10-26 17:11:46 +02:00
|
|
|
|
|
|
|
use Monolog\Handler\AbstractProcessingHandler;
|
|
|
|
use Psr\Log\LogLevel;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
class OutputLogHandler extends AbstractProcessingHandler
|
|
|
|
{
|
|
|
|
|
2013-10-26 17:25:34 +02:00
|
|
|
/**
|
|
|
|
* @var OutputInterface
|
|
|
|
*/
|
|
|
|
protected $output;
|
|
|
|
|
|
|
|
function __construct(
|
|
|
|
OutputInterface $output,
|
|
|
|
$level = LogLevel::INFO,
|
|
|
|
$bubble = true
|
|
|
|
) {
|
|
|
|
parent::__construct($level, $bubble);
|
|
|
|
$this->output = $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function write(array $record)
|
|
|
|
{
|
|
|
|
$this->output->writeln((string)$record['formatted']);
|
|
|
|
}
|
2013-10-26 17:11:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|