8000 [Console] Log exit codes as debug messages instead of errors by haroldiedema · Pull Request #23828 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/EventListener/ErrorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event)
}

if (!$inputString = $this->getInputString($event)) {
return $this->logger->error('The console exited with code "{code}"', array('code' => $exitCode));
return $this->logger->debug('The console exited with code "{code}"', array('code' => $exitCode));
}

$this->logger->error('Command "{command}" exited with code "{code}"', array('command' => $inputString, 'code' => $exitCode));
$this->logger->debug('Command "{command}" exited with code "{code}"', array('command' => $inputString, 'code' => $exitCode));
}

public static function getSubscribedEvents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog()
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255))
;

Expand All @@ -74,7 +74,7 @@ public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog()
$logger = $this->getLogger();
$logger
->expects($this->never())
->method('error')
->method('debug')
;

$listener = new ErrorListener($logger);
7842 Expand All @@ -97,7 +97,7 @@ public function testAllKindsOfInputCanBeLogged()
$logger = $this->getLogger();
$logger
->expects($this->exactly(3))
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run --foo=bar', 'code' => 255))
;

Expand All @@ -112,7 +112,7 @@ public function testCommandNameIsDisplayedForNonStringableInput()
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255))
;

Expand Down
0