Skip to content

Commit 69fcd07

Browse files
committed
Fix console logger according to PSR-3
1 parent 64398da commit 69fcd07

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Console/EventListener/ErrorListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function onConsoleError(ConsoleErrorEvent $event)
4040
$error = $event->getError();
4141

4242
if (!$inputString = $this->getInputString($event)) {
43-
$this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
43+
$this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
4444

4545
return;
4646
}
4747

48-
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
48+
$this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
4949
}
5050

5151
public function onConsoleTerminate(ConsoleTerminateEvent $event)

src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testOnConsoleError()
3333
$logger = $this->getLogger();
3434
$logger
3535
->expects($this->once())
36-
->method('error')
36+
->method('critical')
3737
->with('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'])
3838
;
3939

@@ -48,7 +48,7 @@ public function testOnConsoleErrorWithNoCommandAndNoInputString()
4848
$logger = $this->getLogger();
4949
$logger
5050
->expects($this->once())
51-
->method('error')
51+
->method('critical')
5252
->with('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => 'An error occurred'])
5353
;
5454

0 commit comments

Comments
 (0)