|
@@ -54,16 +54,24 @@ class WildfireFormatter extends NormalizerFormatter
|
|
|
|
|
|
|
|
$record = $this->normalize($record);
|
|
$record = $this->normalize($record);
|
|
|
$message = array('message' => $record['message']);
|
|
$message = array('message' => $record['message']);
|
|
|
|
|
+ $handleError = false;
|
|
|
if ($record['context']) {
|
|
if ($record['context']) {
|
|
|
$message['context'] = $record['context'];
|
|
$message['context'] = $record['context'];
|
|
|
|
|
+ $handleError = true;
|
|
|
}
|
|
}
|
|
|
if ($record['extra']) {
|
|
if ($record['extra']) {
|
|
|
$message['extra'] = $record['extra'];
|
|
$message['extra'] = $record['extra'];
|
|
|
|
|
+ $handleError = true;
|
|
|
}
|
|
}
|
|
|
if (count($message) === 1) {
|
|
if (count($message) === 1) {
|
|
|
$message = reset($message);
|
|
$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
|
|
// Create JSON object describing the appearance of the message in the console
|
|
|
$json = json_encode(array(
|
|
$json = json_encode(array(
|
|
|
array(
|
|
array(
|
|
@@ -75,6 +83,10 @@ class WildfireFormatter extends NormalizerFormatter
|
|
|
$message,
|
|
$message,
|
|
|
));
|
|
));
|
|
|
|
|
|
|
|
|
|
+ if ($handleError) {
|
|
|
|
|
+ restore_error_handler();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// The message itself is a serialization of the above JSON object + it's length
|
|
// The message itself is a serialization of the above JSON object + it's length
|
|
|
return sprintf(
|
|
return sprintf(
|
|
|
'%s|%s|',
|
|
'%s|%s|',
|