Fix console logger according to PSR-3

This commit is contained in:
Alexandre Parent 2021-01-21 09:05:34 -05:00
parent 64398da6cd
commit 69fcd075eb
2 changed files with 4 additions and 4 deletions

View File

@ -40,12 +40,12 @@ class ErrorListener implements EventSubscriberInterface
$error = $event->getError();
if (!$inputString = $this->getInputString($event)) {
$this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
$this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
return;
}
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
$this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
}
public function onConsoleTerminate(ConsoleTerminateEvent $event)

View File

@ -33,7 +33,7 @@ class ErrorListenerTest extends TestCase
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('critical')
->with('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'])
;
@ -48,7 +48,7 @@ class ErrorListenerTest extends TestCase
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('critical')
->with('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => 'An error occurred'])
;