mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
Fix wildfire formatter with custom data types, refs #89
This commit is contained in:
@@ -20,7 +20,7 @@ use Monolog\Logger;
|
|||||||
* @author Christophe Coevoet <stof@notk.org>
|
* @author Christophe Coevoet <stof@notk.org>
|
||||||
* @author Kirill chEbba Chebunin <iam@chebba.org>
|
* @author Kirill chEbba Chebunin <iam@chebba.org>
|
||||||
*/
|
*/
|
||||||
class WildfireFormatter implements FormatterInterface
|
class WildfireFormatter extends NormalizerFormatter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Translates Monolog log levels to Wildfire levels.
|
* Translates Monolog log levels to Wildfire levels.
|
||||||
@@ -50,6 +50,7 @@ class WildfireFormatter implements FormatterInterface
|
|||||||
unset($record['extra']['line']);
|
unset($record['extra']['line']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$record = $this->normalize($record);
|
||||||
$message = array('message' => $record['message']);
|
$message = array('message' => $record['message']);
|
||||||
if ($record['context']) {
|
if ($record['context']) {
|
||||||
$message['context'] = $record['context'];
|
$message['context'] = $record['context'];
|
||||||
@@ -84,4 +85,13 @@ class WildfireFormatter implements FormatterInterface
|
|||||||
{
|
{
|
||||||
throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter');
|
throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function normalize($data)
|
||||||
|
{
|
||||||
|
if (is_object($data) && !$data instanceof \DateTime) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::normalize($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user