]> git.mxchange.org Git - friendica.git/commitdiff
Setup container with explicit LogChannel
authorArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 08:10:06 +0000 (08:10 +0000)
committerArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 08:10:06 +0000 (08:10 +0000)
src/App.php

index ae9a6334e37963485bf6879f719d9e20d19d9780..b5711589a095becef811e41f849c2f5261c86421 100644 (file)
@@ -125,6 +125,8 @@ class App
        {
                $this->setupContainerForAddons();
 
+               $this->setupContainerForLogger(LogChannel::DEFAULT);
+
                $this->container = $this->container->addRule(Mode::class, [
                        'call' => [
                                ['determineRunMode', [false, $request->getServerParams()], Dice::CHAIN_CALL],
@@ -170,9 +172,7 @@ class App
        {
                $this->setupContainerForAddons();
 
-               $this->container = $this->container->addRule(LoggerInterface::class,[
-                       'constructParams' => [LogChannel::AUTH_JABBERED],
-               ]);
+               $this->setupContainerForLogger(LogChannel::AUTH_JABBERED);
 
                $this->setupLegacyServerLocator();
 
@@ -194,9 +194,7 @@ class App
        {
                $this->setupContainerForAddons();
 
-               $this->container = $this->container->addRule(LoggerInterface::class, [
-                       'constructParams' => [LogChannel::CONSOLE],
-               ]);
+               $this->setupContainerForLogger(LogChannel::CONSOLE);
 
                $this->setupLegacyServerLocator();
 
@@ -213,6 +211,13 @@ class App
                $this->container = $this->container->addRules($addonLoader->getActiveAddonConfig('dependencies'));
        }
 
+       private function setupContainerForLogger(string $logChannel): void
+       {
+               $this->container = $this->container->addRule(LoggerInterface::class, [
+                       'constructParams' => [$logChannel],
+               ]);
+       }
+
        private function setupLegacyServerLocator(): void
        {
                \Friendica\DI::init($this->container);