Move registerErrorHandler() into App class

This commit is contained in:
Art4 2025-01-09 08:53:07 +00:00
parent 04fb9dd9e0
commit 633c692083
2 changed files with 13 additions and 10 deletions

View file

@ -29,6 +29,7 @@ use Friendica\Security\Authentication;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger\Capability\LogChannel; use Friendica\Core\Logger\Capability\LogChannel;
use Friendica\Core\Logger\Handler\ErrorHandler;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Update; use Friendica\Core\Update;
@ -137,7 +138,9 @@ class App
$this->setupContainerForAddons(); $this->setupContainerForAddons();
$this->container->setup(LogChannel::APP, false); $this->container->setup(LogChannel::APP);
$this->registerErrorHandler();
$this->requestId = $this->container->create(Request::class)->getRequestId(); $this->requestId = $this->container->create(Request::class)->getRequestId();
$this->auth = $this->container->create(Authentication::class); $this->auth = $this->container->create(Authentication::class);
@ -175,6 +178,8 @@ class App
{ {
$this->setupContainerForAddons(); $this->setupContainerForAddons();
$this->registerErrorHandler();
$this->registerTemplateEngine(); $this->registerTemplateEngine();
(\Friendica\Core\Console::create($this->container, $argv))->execute(); (\Friendica\Core\Console::create($this->container, $argv))->execute();
@ -184,9 +189,9 @@ class App
{ {
$this->setupContainerForAddons(); $this->setupContainerForAddons();
$this->container->setup(LogChannel::AUTH_JABBERED, false); $this->container->setup(LogChannel::AUTH_JABBERED);
$this->registerTemplateEngine(); $this->registerErrorHandler();
/** @var BasePath */ /** @var BasePath */
$basePath = $this->container->create(BasePath::class); $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 private function registerTemplateEngine(): void
{ {
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine'); Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');

View file

@ -11,7 +11,6 @@ namespace Friendica\Core;
use Dice\Dice; use Dice\Dice;
use Friendica\Core\Logger\Capability\LogChannel; use Friendica\Core\Logger\Capability\LogChannel;
use Friendica\Core\Logger\Handler\ErrorHandler;
use Friendica\DI; use Friendica\DI;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -49,7 +48,6 @@ final class DiceContainer implements Container
{ {
$this->setupContainerForLogger($logChannel); $this->setupContainerForLogger($logChannel);
$this->setupLegacyServiceLocator(); $this->setupLegacyServiceLocator();
$this->registerErrorHandler();
} }
/** /**
@ -89,9 +87,4 @@ final class DiceContainer implements Container
{ {
DI::init($this->container); DI::init($this->container);
} }
private function registerErrorHandler(): void
{
ErrorHandler::register($this->container->create(LoggerInterface::class));
}
} }