Skip to content

Commit

Permalink
Revert setting tpay logs in DI extenstion as this config is not stored
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel committed Nov 5, 2024
1 parent 7ff57ba commit 51c3733
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/DependencyInjection/CommerceWeaversSyliusTpayExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -44,7 +43,6 @@ public function prepend(ContainerBuilder $container): void
$container,
);

$this->setUpTpayLogger($container);
$this->prependDoctrineMigrations($container);
$this->prependDoctrineMapping($container);
}
Expand Down Expand Up @@ -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));
}
}
8 changes: 7 additions & 1 deletion tests/Application/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use App\Kernel;
use Tpay\OpenApi\Utilities\Logger;

$_SERVER['APP_RUNTIME_OPTIONS'] = [
'project_dir' => dirname(__DIR__),
Expand All @@ -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;
};

0 comments on commit 51c3733

Please sign in to comment.