Skip to content

Commit

Permalink
Using FileReporter only in local environment (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmakouz committed Dec 21, 2023
1 parent e9ed32d commit c6e775f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Spiral\Boot\AbstractKernel;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Boot\Environment\AppEnvironment;
use Spiral\Exceptions\ExceptionHandler;
use Spiral\Exceptions\Renderer\ConsoleRenderer;
use Spiral\Exceptions\Renderer\JsonRenderer;
Expand Down Expand Up @@ -46,14 +47,16 @@ public function init(AbstractKernel $kernel): void
});
}

public function boot(LoggerReporter $logger, FileReporter $files): void
public function boot(LoggerReporter $logger, FileReporter $files, AppEnvironment $appEnv): void
{
// Register the logger reporter, that will be used to log the exceptions using
// the logger component.
$this->handler->addReporter($logger);

// Register the file reporter. It allows you to save detailed information about an exception to a file
// known as snapshot.
$this->handler->addReporter($files);
if ($appEnv->isLocal()) {
$this->handler->addReporter($files);
}
}
}

0 comments on commit c6e775f

Please sign in to comment.