Skip to content

Commit b2136d6

Browse files
committed
Support getContext from throwables
1 parent a42ad1f commit b2136d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/LoggerMiddleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public function error(
134134
$this->context[$transactionId][self::ERROR]['line'] = $throwable->getLine();
135135
$this->context[$transactionId][self::ERROR]['trace'] = $throwable->getTraceAsString();
136136

137+
if (method_exists($throwable, 'getContext')) {
138+
$this->context[$transactionId][self::ERROR]['context'] = $throwable->getContext();
139+
}
140+
137141
$this->logger->log($options[self::class][Options::ERROR_LEVEL], $message, $this->context[$transactionId]);
138142
unset($this->context[$transactionId]);
139143

0 commit comments

Comments
 (0)