From c9ab4142797692e673f971881d7f62785a87ac0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A1la?= Date: Fri, 13 Apr 2018 09:07:40 +0200 Subject: [PATCH] =?UTF-8?q?Dopln=C4=9Bno=20logov=C3=A1n=C3=AD=20chyb=20apl?= =?UTF-8?q?ikace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DI/Extension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DI/Extension.php b/src/DI/Extension.php index 19e163d..b5bc99f 100644 --- a/src/DI/Extension.php +++ b/src/DI/Extension.php @@ -29,6 +29,11 @@ public function beforeCompile() $application = $containerBuilder->getDefinition($containerBuilder->getByType(Nette\Application\Application::class)); $application->addSetup('?->onPresenter[] = ?', ['@self', [$presenterBridge, 'onPresenter']]); + + $application->addSetup('?->onError[] = function (\Nette\Application\Application $sender, \Throwable $e): void {' . "\n" . + "\t" . 'if ($e instanceof \Nette\Application\BadRequestException) return;' . "\n" . + "\t" . '$this->getService("monolog.logger")->error($e, ["exception" => $e]);' . "\n" . + '}', ['@self']); }