]> git.mxchange.org Git - friendica.git/commitdiff
Remove obsolet LegacyLoggerFactory
authorArt4 <art4@wlabs.de>
Mon, 14 Apr 2025 14:40:44 +0000 (14:40 +0000)
committerArt4 <art4@wlabs.de>
Mon, 14 Apr 2025 14:40:44 +0000 (14:40 +0000)
src/Core/Logger/Factory/LegacyLoggerFactory.php [deleted file]
tests/Unit/Core/Logger/Factory/LegacyLoggerFactoryTest.php [deleted file]

diff --git a/src/Core/Logger/Factory/LegacyLoggerFactory.php b/src/Core/Logger/Factory/LegacyLoggerFactory.php
deleted file mode 100644 (file)
index 2c7b6c0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-// Copyright (C) 2010-2024, the Friendica project
-// SPDX-FileCopyrightText: 2010-2024 the Friendica project
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-declare(strict_types=1);
-
-namespace Friendica\Core\Logger\Factory;
-
-use Friendica\Core\Config\Capability\IManageConfigValues;
-use Friendica\Core\Hooks\Capability\ICanCreateInstances;
-use Friendica\Util\Profiler;
-use Psr\Log\LoggerInterface;
-
-/**
- * Bridge for the legacy Logger factory.
- *
- * This class can be removed after the following classes are replaced or
- * refactored implementing the `\Friendica\Core\Logger\Factory\LoggerFactory`:
- *
- * - Friendica\Core\Logger\Factory\StreamLogger
- * - Friendica\Core\Logger\Factory\SyslogLogger
- * - monolog addon: Friendica\Addon\monolog\src\Factory\Monolog
- *
- * @see \Friendica\Core\Logger\Factory\StreamLogger
- * @see \Friendica\Core\Logger\Factory\SyslogLogger
- *
- * @internal
- */
-final class LegacyLoggerFactory implements LoggerFactory
-{
-       private ICanCreateInstances $instanceCreator;
-
-       private IManageConfigValues $config;
-
-       private Profiler $profiler;
-
-       public function __construct(ICanCreateInstances $instanceCreator, IManageConfigValues $config, Profiler $profiler)
-       {
-               $this->instanceCreator = $instanceCreator;
-               $this->config          = $config;
-               $this->profiler        = $profiler;
-       }
-
-       /**
-        * Creates and returns a PSR-3 Logger instance.
-        *
-        * Calling this method multiple times with the same parameters SHOULD return the same object.
-        *
-        * @param \Psr\Log\LogLevel::* $logLevel The log level
-        * @param \Friendica\Core\Logger\Capability\LogChannel::* $logChannel The log channel
-        */
-       public function createLogger(string $logLevel, string $logChannel): LoggerInterface
-       {
-               $factory = new Logger($logChannel);
-
-               return $factory->create($this->instanceCreator, $this->config, $this->profiler);
-       }
-}
diff --git a/tests/Unit/Core/Logger/Factory/LegacyLoggerFactoryTest.php b/tests/Unit/Core/Logger/Factory/LegacyLoggerFactoryTest.php
deleted file mode 100644 (file)
index 9ef920c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-// Copyright (C) 2010-2024, the Friendica project
-// SPDX-FileCopyrightText: 2010-2024 the Friendica project
-//
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-declare(strict_types=1);
-
-namespace Friendica\Test\Unit\Core\Logger\Factory;
-
-use Friendica\Core\Config\Capability\IManageConfigValues;
-use Friendica\Core\Hooks\Capability\ICanCreateInstances;
-use Friendica\Core\Logger\Capability\LogChannel;
-use Friendica\Core\Logger\Factory\LegacyLoggerFactory;
-use Friendica\Util\Profiler;
-use PHPUnit\Framework\TestCase;
-use Psr\Log\LoggerInterface;
-use Psr\Log\LogLevel;
-
-class LegacyLoggerFactoryTest extends TestCase
-{
-       public function testCreateLoggerReturnsPsrLogger(): void
-       {
-               $factory = new LegacyLoggerFactory(
-                       $this->createStub(ICanCreateInstances::class),
-                       $this->createStub(IManageConfigValues::class),
-                       $this->createStub(Profiler::class),
-               );
-
-               $this->assertInstanceOf(
-                       LoggerInterface::class,
-                       $factory->createLogger(LogLevel::DEBUG, LogChannel::DEFAULT)
-               );
-       }
-}