Move setupContainerForLogger() and determine log channel into App class

This commit is contained in:
Art4 2025-01-09 10:13:33 +00:00
parent 870b3b9a1c
commit 7f643aadd8
4 changed files with 36 additions and 23 deletions

View file

@ -187,12 +187,6 @@ HELP;
$className = $this->subConsoles[$command];
if (is_subclass_of($className, Friendica\Console\AbstractConsole::class)) {
$this->container->setup($className::LOG_CHANNEL);
} else {
$this->container->setup(LogChannel::CONSOLE);
}
/** @var Console $subconsole */
$subconsole = $this->container->create($className, [$subargs]);

View file

@ -19,11 +19,9 @@ interface Container
*
* @deprecated
*
* @param string $logChannel The Log Channel of this call
*
* @return void
*/
public function setup(string $logChannel): void;
public function setup(): void;
/**
* Returns a fully constructed object based on $name using $args and $share as constructor arguments if supplied

View file

@ -11,7 +11,6 @@ namespace Friendica\Core;
use Dice\Dice;
use Friendica\DI;
use Psr\Log\LoggerInterface;
/**
* Wrapper for the Dice class to make some basic setups
@ -39,13 +38,10 @@ final class DiceContainer implements Container
*
* @deprecated
*
* @param string $logChannel The Log Channel of this call
*
* @return void
*/
public function setup(string $logChannel): void
public function setup(): void
{
$this->setupContainerForLogger($logChannel);
$this->setupLegacyServiceLocator();
}
@ -75,13 +71,6 @@ final class DiceContainer implements Container
$this->container = $this->container->addRule($name, $rule);
}
private function setupContainerForLogger(string $logChannel): void
{
$this->container = $this->container->addRule(LoggerInterface::class, [
'constructParams' => [$logChannel],
]);
}
private function setupLegacyServiceLocator(): void
{
DI::init($this->container);