diff --git a/src/Illuminate/Foundation/Exceptions/Handler.php b/src/Illuminate/Foundation/Exceptions/Handler.php index 6da808a4f352..4effa0c9990d 100644 --- a/src/Illuminate/Foundation/Exceptions/Handler.php +++ b/src/Illuminate/Foundation/Exceptions/Handler.php @@ -368,9 +368,7 @@ protected function reportThrowable(Throwable $e): void throw $e; } - $level = Arr::first( - $this->levels, fn ($level, $type) => $e instanceof $type, LogLevel::ERROR - ); + $level = $this->mapLogLevel($e); $context = $this->buildExceptionContext($e); @@ -1047,6 +1045,19 @@ protected function isHttpException(Throwable $e) return $e instanceof HttpExceptionInterface; } + /** + * Map the exception to a log level. + * + * @param \Throwable $e + * @return \Psr\Log\LogLevel::* + */ + protected function mapLogLevel(Throwable $e) + { + return Arr::first( + $this->levels, fn ($level, $type) => $e instanceof $type, LogLevel::ERROR + ); + } + /** * Create a new logger instance. *