diff --git a/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php b/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php index ea1a7da1..fd3dc611 100644 --- a/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php +++ b/src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php @@ -11,7 +11,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Tpay\OpenApi\Utilities\Logger; final class CommerceWeaversSyliusTpayExtension extends AbstractResourceExtension implements PrependExtensionInterface { @@ -44,7 +43,6 @@ public function prepend(ContainerBuilder $container): void $container, ); - $this->setUpTpayLogger($container); $this->prependDoctrineMigrations($container); $this->prependDoctrineMapping($container); } @@ -107,19 +105,4 @@ private function getCurrentConfiguration(ContainerBuilder $container): array return $this->processConfiguration($configuration, $configs); } - - private function setUpTpayLogger(ContainerBuilder $container): void - { - if (!$container->hasParameter('kernel.logs_dir')) { - return; - } - - $logsDir = $container->getParameter('kernel.logs_dir'); - - if (!is_string($logsDir)) { - return; - } - - Logger::setLogPath(sprintf('%s/tpay_open_api_', $logsDir)); - } } diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 9bcfadc6..5adff0e7 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -3,6 +3,7 @@ declare(strict_types=1); use App\Kernel; +use Tpay\OpenApi\Utilities\Logger; $_SERVER['APP_RUNTIME_OPTIONS'] = [ 'project_dir' => dirname(__DIR__), @@ -11,5 +12,10 @@ require_once dirname(__DIR__, 3).'/vendor/autoload_runtime.php'; return function (array $context) { - return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); + $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); + + // set up Tpay logger + Logger::setLogPath(sprintf('%s/tpay_open_api_', $kernel->getLogDir())); + + return $kernel; };