Skip to content

Commit

Permalink
Remembers the log default driver
Browse files Browse the repository at this point in the history
  • Loading branch information
a.stecher committed Feb 9, 2025
1 parent 2e995b0 commit 56996a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Listeners/FlushLogContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class FlushLogContext
* @var ?LogManager
*/
private $log = null;
private $logDefaultDriver = null;

public function __construct()
{
if (app()->resolved('log')) {
$this->log = app('log');
$this->logDefaultDriver = $this->log->driver();
}
}

Expand All @@ -33,8 +35,8 @@ public function handle($event): void
$this->log->flushSharedContext();
}

if (method_exists($this->log->driver(), 'withoutContext')) {
$this->log->driver()->withoutContext();
if (method_exists($this->logDefaultDriver, 'withoutContext')) {
$this->logDefaultDriver->withoutContext();
}

if (method_exists($this->log, 'withoutContext')) {
Expand Down

0 comments on commit 56996a7

Please sign in to comment.