Skip to content

Commit

Permalink
TASK: Fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Mar 28, 2023
1 parent a3d747b commit 1b7a060
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Resources/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

$parameters->set('name', 'TYPO3 Surf');

$parameters->set('version', '3.3.6');
$parameters->set('version', '3.3.7');

$services = $containerConfigurator->services();

Expand Down
54 changes: 29 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions src/Domain/Model/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
namespace TYPO3\Surf\Domain\Model;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Symfony\Component\OptionsResolver\Exception\ExceptionInterface;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
Expand All @@ -23,16 +21,12 @@
use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TYPO3\Surf\Exception\InvalidConfigurationException;
use TYPO3\Surf\Integration\LoggerAwareTrait;

abstract class Task implements LoggerAwareInterface
{
use LoggerAwareTrait;

/**
* @var LoggerInterface
*/
protected $logger;

/**
* @return mixed|void
*/
Expand Down
9 changes: 3 additions & 6 deletions src/Domain/Model/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
namespace TYPO3\Surf\Domain\Model;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use TYPO3\Surf\Domain\Service\TaskManager;
use TYPO3\Surf\Exception as SurfException;
use TYPO3\Surf\Exception\TaskExecutionException;
use TYPO3\Surf\Integration\LoggerAwareTrait;

/**
* A Workflow
Expand All @@ -25,16 +25,13 @@ abstract class Workflow implements LoggerAwareInterface
{
use LoggerAwareTrait;

/**
* @var LoggerInterface
*/
protected $logger;
protected TaskManager $taskManager;

protected array $tasks = [];

public function __construct(TaskManager $taskManager)
{
$this->logger = new NullLogger();
$this->taskManager = $taskManager;
}

Expand Down
13 changes: 7 additions & 6 deletions src/Domain/Service/ShellCommandService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@
use Neos\Utility\Files;
use Phar;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use Symfony\Component\Process\Process;
use TYPO3\Surf\Domain\Model\Deployment;
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Exception\TaskExecutionException;
use TYPO3\Surf\Integration\LoggerAwareTrait;

/**
* A shell command service
*/
class ShellCommandService implements LoggerAwareInterface
{
/**
* @var Logger
*/
protected $logger;

use LoggerAwareTrait;

public function __construct()
{
$this->logger = new NullLogger();
}

/**
* Execute a shell command (locally or remote depending on the node hostname)
*
Expand Down
10 changes: 3 additions & 7 deletions src/Domain/Service/TaskManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
namespace TYPO3\Surf\Domain\Service;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use TYPO3\Surf\Domain\Model\Application;
use TYPO3\Surf\Domain\Model\Deployment;
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\TaskInHistory;
use TYPO3\Surf\Integration\LoggerAwareTrait;

/**
* @final
Expand All @@ -26,11 +26,6 @@ class TaskManager implements LoggerAwareInterface
{
use LoggerAwareTrait;

/**
* @var LoggerInterface
*/
protected $logger;

/**
* @var TaskInHistory[]
*/
Expand All @@ -40,6 +35,7 @@ class TaskManager implements LoggerAwareInterface

public function __construct(TaskFactory $taskFactory)
{
$this->logger = new NullLogger();
$this->taskFactory = $taskFactory;
}

Expand Down
17 changes: 17 additions & 0 deletions src/Integration/LoggerAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace TYPO3\Surf\Integration;

use Psr\Log\LoggerInterface;

trait LoggerAwareTrait
{
protected LoggerInterface $logger;

public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

0 comments on commit 1b7a060

Please sign in to comment.