1
0
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:
Christophe Coevoet
2011-05-11 18:43:04 +02:00
parent 1d6697294d
commit 0defabb726
11 changed files with 103 additions and 82 deletions

View File

@@ -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;
}
}