Extract logging logic to a service, make logs mutable

[MAILPOET-5568]
This commit is contained in:
Jan Jakes
2023-09-01 14:19:01 +02:00
committed by Aschepikov
parent 43c396220b
commit dd881d8b33
6 changed files with 155 additions and 33 deletions

View File

@ -0,0 +1,26 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Control;
use MailPoet\Automation\Engine\Hooks;
use MailPoet\Automation\Engine\Storage\AutomationRunLogStorage;
class StepRunLoggerFactory {
/** @var AutomationRunLogStorage */
private $automationRunLogStorage;
/** @var Hooks */
private $hooks;
public function __construct(
AutomationRunLogStorage $automationRunLogStorage,
Hooks $hooks
) {
$this->automationRunLogStorage = $automationRunLogStorage;
$this->hooks = $hooks;
}
public function createLogger(int $runId, string $stepId): StepRunLogger {
return new StepRunLogger($this->automationRunLogStorage, $this->hooks, $runId, $stepId);
}
}