mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
check if val is null to avoid to set the string "null" instead of null
This commit is contained in:
committed by
Jordi Boggiano
parent
83a24937ba
commit
3101f1c09a
@@ -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));
|
||||
|
Reference in New Issue
Block a user