mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 00:56:08 +02:00
Override getDefaultFormatter instead of creating a formatter with 'new' in method 'write'. Using levelMap again. Refactored test.
This commit is contained in:
@@ -61,9 +61,9 @@ class ZendMonitorHandler extends AbstractProcessingHandler
|
||||
protected function write(array $record)
|
||||
{
|
||||
if ($this->isZendServer()) {
|
||||
$formatter = new NormalizerFormatter();
|
||||
$formatter = $this->getDefaultFormatter();
|
||||
$record = $formatter->format($record);
|
||||
$this->writeZendMonitorCustomEvent($record['level'], $record['message']);
|
||||
$this->writeZendMonitorCustomEvent($this->levelMap[$record['level']], $record['message']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,24 @@ class ZendMonitorHandler extends AbstractProcessingHandler
|
||||
zend_monitor_custom_event($level, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultFormatter()
|
||||
{
|
||||
return new NormalizerFormatter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the level map
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLevelMap()
|
||||
{
|
||||
return $this->levelMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Zend Server?
|
||||
*
|
||||
|
Reference in New Issue
Block a user