1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

Resolve json encoding errors issue globally, refs #137

This commit is contained in:
Jordi Boggiano
2013-01-06 20:14:14 +01:00
parent 271c396964
commit 63e3bfdf7e
5 changed files with 71 additions and 52 deletions

View File

@@ -67,13 +67,8 @@ class WildfireFormatter extends NormalizerFormatter
$message = reset($message);
}
// Handle json_encode recursion error
if ($handleError) {
set_error_handler(function () { });
}
// Create JSON object describing the appearance of the message in the console
$json = json_encode(array(
$json = $this->toJson(array(
array(
'Type' => $this->logLevels[$record['level']],
'File' => $file,
@@ -81,11 +76,7 @@ class WildfireFormatter extends NormalizerFormatter
'Label' => $record['channel'],
),
$message,
));
if ($handleError) {
restore_error_handler();
}
), $handleError);
// The message itself is a serialization of the above JSON object + it's length
return sprintf(