1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 01:26:11 +02:00

Split interfaces and base/abstract classes into more sensible pieces

This commit is contained in:
Jordi Boggiano
2015-10-09 20:41:09 +01:00
parent 39f8a20e6d
commit 902c0c8694
17 changed files with 356 additions and 209 deletions

View File

@@ -19,8 +19,11 @@ namespace Monolog\Handler;
* @author Jordi Boggiano <j.boggiano@seld.be>
* @author Christophe Coevoet <stof@notk.org>
*/
abstract class AbstractProcessingHandler extends AbstractHandler
abstract class AbstractProcessingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface
{
use ProcessableHandlerTrait;
use FormattableHandlerTrait;
/**
* {@inheritdoc}
*/
@@ -30,7 +33,9 @@ abstract class AbstractProcessingHandler extends AbstractHandler
return false;
}
$record = $this->processRecord($record);
if ($this->processors) {
$record = $this->processRecord($record);
}
$record['formatted'] = $this->getFormatter()->format($record);
@@ -46,21 +51,4 @@ abstract class AbstractProcessingHandler extends AbstractHandler
* @return void
*/
abstract protected function write(array $record);
/**
* Processes a record.
*
* @param array $record
* @return array
*/
protected function processRecord(array $record)
{
if ($this->processors) {
foreach ($this->processors as $processor) {
$record = call_user_func($processor, $record);
}
}
return $record;
}
}