1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 23:17:43 +02:00

Prepend input to composer output log (Fixes #7)

This commit is contained in:
SychO9
2021-09-30 21:44:27 +01:00
parent 670a4dd26a
commit 68a3133bbb
7 changed files with 11 additions and 9 deletions

View File

@@ -59,7 +59,7 @@ class CheckForUpdatesHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerCommandFailedException('', $output); throw new ComposerCommandFailedException('', $output);

View File

@@ -64,7 +64,7 @@ class GlobalUpdateHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerUpdateFailedException('*', $output); throw new ComposerUpdateFailedException('*', $output);

View File

@@ -66,7 +66,7 @@ class MinorFlarumUpdateHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerUpdateFailedException('flarum/*', $output); throw new ComposerUpdateFailedException('flarum/*', $output);

View File

@@ -70,7 +70,7 @@ class RemoveExtensionHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerCommandFailedException($extension->name, $output); throw new ComposerCommandFailedException($extension->name, $output);

View File

@@ -80,7 +80,7 @@ class RequireExtensionHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerRequireFailedException($command->package, $output); throw new ComposerRequireFailedException($command->package, $output);

View File

@@ -92,7 +92,7 @@ class UpdateExtensionHandler
$exitCode = $this->composer->run($input, $output); $exitCode = $this->composer->run($input, $output);
$output = $output->fetch(); $output = $output->fetch();
$this->logger->log($output, $exitCode); $this->logger->log($input->__toString(), $output, $exitCode);
if ($exitCode !== 0) { if ($exitCode !== 0) {
throw new ComposerUpdateFailedException($extension->name, $output); throw new ComposerUpdateFailedException($extension->name, $output);

View File

@@ -16,12 +16,14 @@ class OutputLogger
$this->logger = $logger; $this->logger = $logger;
} }
public function log(string $output, int $exitCode): void public function log(string $input, string $output, int $exitCode): void
{ {
$content = "$input\n$output";
if ($exitCode === 0) { if ($exitCode === 0) {
$this->logger->info($output); $this->logger->info($content);
} else { } else {
$this->logger->error($output); $this->logger->error($content);
} }
} }
} }