mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 17:16:18 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -106,7 +106,7 @@ class GelfMessageFormatter extends NormalizerFormatter
|
||||
}
|
||||
|
||||
foreach ($record['extra'] as $key => $val) {
|
||||
$val = is_scalar($val) ? $val : $this->toJson($val);
|
||||
$val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
||||
$len += strlen($this->extraPrefix . $key . $val);
|
||||
if ($len > self::MAX_LENGTH) {
|
||||
$message->setAdditional($this->extraPrefix . $key, substr($val, 0, self::MAX_LENGTH - $len));
|
||||
@@ -116,7 +116,7 @@ class GelfMessageFormatter extends NormalizerFormatter
|
||||
}
|
||||
|
||||
foreach ($record['context'] as $key => $val) {
|
||||
$val = is_scalar($val) ? $val : $this->toJson($val);
|
||||
$val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
||||
$len += strlen($this->contextPrefix . $key . $val);
|
||||
if ($len > self::MAX_LENGTH) {
|
||||
$message->setAdditional($this->contextPrefix . $key, substr($val, 0, self::MAX_LENGTH - $len));
|
||||
|
@@ -186,6 +186,9 @@ class JsonFormatter extends NormalizerFormatter
|
||||
foreach ($trace as $frame) {
|
||||
if (isset($frame['file'])) {
|
||||
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
||||
} elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
$data['trace'][] = $frame['function'];
|
||||
} else {
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
$data['trace'][] = $this->normalize($frame);
|
||||
|
@@ -129,6 +129,9 @@ class NormalizerFormatter implements FormatterInterface
|
||||
foreach ($trace as $frame) {
|
||||
if (isset($frame['file'])) {
|
||||
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
||||
} elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
$data['trace'][] = $frame['function'];
|
||||
} else {
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
$data['trace'][] = $this->toJson($this->normalize($frame), true);
|
||||
|
Reference in New Issue
Block a user