Skip to content

Commit

Permalink
Added the context for php errors
Browse files Browse the repository at this point in the history
  • Loading branch information
waltertamboer committed Jun 6, 2018
1 parent 848555e commit 087d0b4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Formatter/HumanReadableExceptionFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ public function format(array $record): string
$record['message']
);

if (isset($record['context']['file'])) {
$result .= "[Context]\n\n";

if (isset($record['context']['message'])) {
$result .= sprintf(" Message: %s\n", $record['context']['message']);
}

$result .= sprintf(" File: %s\n", $record['context']['file']);
$result .= sprintf(" Line: %d\n", $record['context']['line']);

if (isset($record['context']['code'])) {
$result .= sprintf(" Code: %s\n\n", $record['context']['code']);
}
}

$exceptionCounter = 1;

while ($throwable !== null) {
Expand Down

0 comments on commit 087d0b4

Please sign in to comment.