Skip to content

Commit

Permalink
[10.x] Moves logger instance creation to a protected method (#48759)
Browse files Browse the repository at this point in the history
* moves logger instance creation to a protected method

* formatting

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
rodrigopedra and taylorotwell authored Oct 18, 2023
1 parent 8d8d5f7 commit 2dcc960
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ protected function reportThrowable(Throwable $e): void
}

try {
$logger = $this->container->make(LoggerInterface::class);
$logger = $this->newLogger();
} catch (Exception) {
throw $e;
}
Expand Down Expand Up @@ -872,4 +872,14 @@ protected function isHttpException(Throwable $e)
{
return $e instanceof HttpExceptionInterface;
}

/**
* Create a new logger instance.
*
* @return \Psr\Log\LoggerInterface
*/
protected function newLogger()
{
return $this->container->make(LoggerInterface::class);
}
}

0 comments on commit 2dcc960

Please sign in to comment.