Skip to content

Commit e14519f

Browse files
committed
ICL: HtmlFormatter continued.
1 parent b258443 commit e14519f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Log/HtmlFormatter.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,16 @@ protected function composeTitle(array $record)
8080
protected function composeDetails(array $record)
8181
{
8282
$details = '<table cellspacing="1" width="100%">';
83-
$details .= $this->composeRow('Message', (string) $record['message']);
8483

84+
$details .= $this->composeRow('Message', (string) $record['message']);
8585
if (!empty($record['context'])) {
86-
$contextTable = '<table cellspacing="1" width="100%">';
87-
foreach ($record['context'] as $key => $value) {
88-
$contextTable .= $this->composeRow($key, $this->convertToString($value));
89-
}
90-
$contextTable .= '</table>';
91-
$details .= $this->composeRow('Context', $contextTable, false);
86+
$context = $this->convertToString($record['context']);
87+
$context = e($context);
88+
$details .= $this->composeRow('Context', "<pre>{$context}</pre>", false);
9289
}
93-
9490
$details .= $this->composeRow('Time', $record['datetime']->format($this->dateFormat));
9591
$details .= $this->composeRow('Environment', app()->environment());
92+
9693
$details .= '</table>';
9794

9895
return $details;
@@ -103,12 +100,20 @@ protected function composeRow($header, $body = ' ', $escapeBody = true)
103100
$header = e($header);
104101
if ($escapeBody) {
105102
$body = e($body);
106-
$body = "<div>{$body}</div>";
107103
}
108104

109105
return "<tr class='details-row'>
110106
<th class='details-row-header'>{$header}:</th>
111107
<td class='details-row-body'>{$body}</td>
112108
</tr>";
113109
}
110+
111+
protected function convertToString($data)
112+
{
113+
if (is_array($data)) {
114+
return get_dump($data);
115+
}
116+
117+
return parent::convertToString($data);
118+
}
114119
}

0 commit comments

Comments
 (0)