diff --git a/src/Helper/ExceptionLogger.php b/src/Helper/ExceptionLogger.php index 0f1ea11..2d24569 100644 --- a/src/Helper/ExceptionLogger.php +++ b/src/Helper/ExceptionLogger.php @@ -13,27 +13,27 @@ public function __construct( public function logAndTrace(\Throwable $exception, string $message = null): void { - $message && $this->logger->error($message); - $this->logger->error($exception->getMessage()); - $this->logger->debug($exception->getTraceAsString()); + $message && $this->logger->error($message, ['exception' => $exception]); + $this->logger->error($exception->getMessage(), ['exception' => $exception]); + $this->logger->debug($exception->getTraceAsString(), ['exception' => $exception]); } public function logCriticalAndTrace(\Throwable $exception, string $message = null): void { - $message && $this->logger->critical($message); - $this->logger->critical($exception->getMessage()); - $this->logger->critical($exception->getTraceAsString()); + $message && $this->logger->critical($message, ['exception' => $exception]); + $this->logger->critical($exception->getMessage(), ['exception' => $exception]); + $this->logger->critical($exception->getTraceAsString(), ['exception' => $exception]); } public function log(\Throwable $exception, string $message = null): void { - $message && $this->logger->error($message); - $this->logger->error($exception->getMessage()); + $message && $this->logger->error($message, ['exception' => $exception]); + $this->logger->error($exception->getMessage(), ['exception' => $exception]); } public function logNotice(\Throwable $exception, string $message = null): void { - $message && $this->logger->notice($message); - $this->logger->notice($exception->getMessage()); + $message && $this->logger->notice($message, ['exception' => $exception]); + $this->logger->notice($exception->getMessage(), ['exception' => $exception]); } }