From 633c692083f509dd92bc7611550abd6f2b5cb7ba Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 9 Jan 2025 08:53:07 +0000 Subject: [PATCH] Move registerErrorHandler() into App class --- src/App.php | 16 +++++++++++++--- src/Core/DiceContainer.php | 7 ------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/App.php b/src/App.php index 0b86e3caae..aa6dc51234 100644 --- a/src/App.php +++ b/src/App.php @@ -29,6 +29,7 @@ use Friendica\Security\Authentication; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; use Friendica\Core\Logger\Capability\LogChannel; +use Friendica\Core\Logger\Handler\ErrorHandler; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\System; use Friendica\Core\Update; @@ -137,7 +138,9 @@ class App $this->setupContainerForAddons(); - $this->container->setup(LogChannel::APP, false); + $this->container->setup(LogChannel::APP); + + $this->registerErrorHandler(); $this->requestId = $this->container->create(Request::class)->getRequestId(); $this->auth = $this->container->create(Authentication::class); @@ -175,6 +178,8 @@ class App { $this->setupContainerForAddons(); + $this->registerErrorHandler(); + $this->registerTemplateEngine(); (\Friendica\Core\Console::create($this->container, $argv))->execute(); @@ -184,9 +189,9 @@ class App { $this->setupContainerForAddons(); - $this->container->setup(LogChannel::AUTH_JABBERED, false); + $this->container->setup(LogChannel::AUTH_JABBERED); - $this->registerTemplateEngine(); + $this->registerErrorHandler(); /** @var BasePath */ $basePath = $this->container->create(BasePath::class); @@ -213,6 +218,11 @@ class App } } + private function registerErrorHandler(): void + { + ErrorHandler::register($this->container->create(LoggerInterface::class)); + } + private function registerTemplateEngine(): void { Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine'); diff --git a/src/Core/DiceContainer.php b/src/Core/DiceContainer.php index e5c69c4982..bba5a18ab6 100644 --- a/src/Core/DiceContainer.php +++ b/src/Core/DiceContainer.php @@ -11,7 +11,6 @@ namespace Friendica\Core; use Dice\Dice; use Friendica\Core\Logger\Capability\LogChannel; -use Friendica\Core\Logger\Handler\ErrorHandler; use Friendica\DI; use Psr\Log\LoggerInterface; @@ -49,7 +48,6 @@ final class DiceContainer implements Container { $this->setupContainerForLogger($logChannel); $this->setupLegacyServiceLocator(); - $this->registerErrorHandler(); } /** @@ -89,9 +87,4 @@ final class DiceContainer implements Container { DI::init($this->container); } - - private function registerErrorHandler(): void - { - ErrorHandler::register($this->container->create(LoggerInterface::class)); - } }