|
|
@ -31,8 +31,10 @@ class OutputWithLogger extends OutputWrapper {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param OutputInterface $output The real output interface
|
|
|
|
* @param OutputInterface $output The real output interface
|
|
|
|
* @param TLogger|null $logger The logger
|
|
|
|
* @param TLogger|null $logger The logger
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @noinspection PhpDocSignatureInspection
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function __construct (OutputInterface $output, $logger = null) {
|
|
|
|
public function __construct (OutputInterface $output, LoggerInterface $logger = null) {
|
|
|
|
parent::__construct($output);
|
|
|
|
parent::__construct($output);
|
|
|
|
$this->setLogger($logger);
|
|
|
|
$this->setLogger($logger);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -53,12 +55,10 @@ class OutputWithLogger extends OutputWrapper {
|
|
|
|
* @return $this
|
|
|
|
* @return $this
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @throws InvalidArgumentException If the logger is not null or an instance for {@see LoggerInterface}
|
|
|
|
* @throws InvalidArgumentException If the logger is not null or an instance for {@see LoggerInterface}
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @noinspection PhpDocSignatureInspection
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function setLogger ($logger): self {
|
|
|
|
public function setLogger (LoggerInterface $logger): self {
|
|
|
|
if ($logger !== null && !$logger instanceof LoggerInterface) {
|
|
|
|
|
|
|
|
throw new InvalidArgumentException('The logger must be null or a ' . LoggerInterface::class . ' instance');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->logger = $logger;
|
|
|
|
$this->logger = $logger;
|
|
|
|
return $this;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -118,8 +118,8 @@ class OutputWithLogger extends OutputWrapper {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function writeLn (iterable|string $messages, int $options = 0) {
|
|
|
|
public function writeln (iterable|string $messages, int $options = 0) {
|
|
|
|
$this->writeToLogger($messages, true, $options);
|
|
|
|
$this->writeToLogger($messages, true, $options);
|
|
|
|
return parent::writeLn($messages, $options);
|
|
|
|
return parent::writeln($messages, $options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|