Skip to content

Commit

Permalink
Add the exceptionContext method to the exception handler to allow exc…
Browse files Browse the repository at this point in the history
…eption specific data to be added to the logging context. (#30780)
  • Loading branch information
AbdelElrafa authored and taylorotwell committed Dec 9, 2019
1 parent ff807cc commit 0b41342
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ public function report(Exception $e)

$logger->error(
$e->getMessage(),
array_merge($this->context(), ['exception' => $e]
));
array_merge(
$this->exceptionContext($e),
$this->context(),
['exception' => $e]
)
);
}

/**
Expand Down Expand Up @@ -145,6 +149,17 @@ protected function shouldntReport(Exception $e)
}));
}

/**
* Get the default exception context variables for logging.
*
* @param \Exception $e
* @return array
*/
protected function exceptionContext(Exception $e)
{
return [];
}

/**
* Get the default context variables for logging.
*
Expand Down

0 comments on commit 0b41342

Please sign in to comment.