mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 01:56:18 +02:00
Refactored the AbstractHandler to avoid having some dummy write() methods
This commit is contained in:
@@ -51,24 +51,6 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
return $record['level'] >= $this->level;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
{
|
||||
if ($record['level'] < $this->level) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$record = $this->processRecord($record);
|
||||
|
||||
$record['message'] = $this->getFormatter()->format($record);
|
||||
|
||||
$this->write($record);
|
||||
|
||||
return false === $this->bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -171,14 +153,6 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
$this->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the record down to the log of the implementing handler
|
||||
*
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function write(array $record);
|
||||
|
||||
/**
|
||||
* Gets the default formatter.
|
||||
*
|
||||
@@ -188,21 +162,4 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
{
|
||||
return new LineFormatter();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user