1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

Fix wildfire formatter with custom data types, refs #89

This commit is contained in:
Jordi Boggiano
2012-06-15 18:55:16 +02:00
parent 4829b09743
commit 388056fd92

View File

@@ -20,7 +20,7 @@ use Monolog\Logger;
* @author Christophe Coevoet <stof@notk.org>
* @author Kirill chEbba Chebunin <iam@chebba.org>
*/
class WildfireFormatter implements FormatterInterface
class WildfireFormatter extends NormalizerFormatter
{
/**
* Translates Monolog log levels to Wildfire levels.
@@ -50,6 +50,7 @@ class WildfireFormatter implements FormatterInterface
unset($record['extra']['line']);
}
$record = $this->normalize($record);
$message = array('message' => $record['message']);
if ($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');
}
protected function normalize($data)
{
if (is_object($data) && !$data instanceof \DateTime) {
return $data;
}
return parent::normalize($data);
}
}