From 18b811f8ec7109bd2faf433081e0e170359fdab4 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 1 Nov 2024 12:12:17 +0000 Subject: [PATCH] ADD PSR-3 exception error logging --- src/JsonRPC/Request/RequestParser.php | 4 ++-- src/JsonRPC/Response/ResponseBuilder.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/JsonRPC/Request/RequestParser.php b/src/JsonRPC/Request/RequestParser.php index cc69ce4..b468a0d 100644 --- a/src/JsonRPC/Request/RequestParser.php +++ b/src/JsonRPC/Request/RequestParser.php @@ -227,8 +227,8 @@ protected function handleExceptions(Exception $e) ->withException($e) ->build(); } elseif($this->psr3Logger) { - $this->psr3Logger->error( - $e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()] + $this->psr3Logger->critical( + $e->getMessage(), ['code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()] ); } diff --git a/src/JsonRPC/Response/ResponseBuilder.php b/src/JsonRPC/Response/ResponseBuilder.php index 50c5b53..be960bf 100644 --- a/src/JsonRPC/Response/ResponseBuilder.php +++ b/src/JsonRPC/Response/ResponseBuilder.php @@ -348,9 +348,9 @@ protected function handleExceptions() protected function logException(\Exception $e): void { if (!($e->getCode() >= -32099 && $e->getCode() <= -32000) && $this->psr3Logger) { - $this->psr3Logger->error( + $this->psr3Logger->critical( $e->getMessage(), - ['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()] + ['code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()] ); } }