mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 20:27:31 +02:00
Make sure extra/context variables are stringified when more than one level deep
This commit is contained in:
committed by
Haralan Dobrev
parent
ec75076ded
commit
4ab8ed0a53
@@ -96,7 +96,7 @@ class SlackRecord
|
|||||||
$this->includeContextAndExtra = $includeContextAndExtra;
|
$this->includeContextAndExtra = $includeContextAndExtra;
|
||||||
$this->formatter = $formatter;
|
$this->formatter = $formatter;
|
||||||
|
|
||||||
if ($this->includeContextAndExtra && $this->useShortAttachment) {
|
if ($this->includeContextAndExtra) {
|
||||||
$this->lineFormatter = new LineFormatter();
|
$this->lineFormatter = new LineFormatter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class SlackRecord
|
|||||||
foreach ($record['extra'] as $var => $val) {
|
foreach ($record['extra'] as $var => $val) {
|
||||||
$attachment['fields'][] = array(
|
$attachment['fields'][] = array(
|
||||||
'title' => $var,
|
'title' => $var,
|
||||||
'value' => $val,
|
'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val,
|
||||||
'short' => $this->useShortAttachment,
|
'short' => $this->useShortAttachment,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ class SlackRecord
|
|||||||
foreach ($record['context'] as $var => $val) {
|
foreach ($record['context'] as $var => $val) {
|
||||||
$attachment['fields'][] = array(
|
$attachment['fields'][] = array(
|
||||||
'title' => $var,
|
'title' => $var,
|
||||||
'value' => $val,
|
'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val,
|
||||||
'short' => $this->useShortAttachment,
|
'short' => $this->useShortAttachment,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -308,7 +308,7 @@ class SlackRecordTest extends TestCase
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'tags',
|
'title' => 'tags',
|
||||||
'value' => array('web'),
|
'value' => '["web"]',
|
||||||
'short' => false
|
'short' => false
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
Reference in New Issue
Block a user