77use Sentry \Event ;
88use Sentry \EventHint ;
99use Sentry \ExceptionMechanism ;
10+ use Sentry \Logs \Logs ;
1011use Sentry \State \HubInterface ;
1112use Sentry \State \Scope ;
1213use Symfony \Component \Console \Event \ConsoleCommandEvent ;
@@ -35,8 +36,8 @@ class ConsoleListener
3536 /**
3637 * Constructor.
3738 *
38- * @param HubInterface $hub The current hub
39- * @param bool $captureErrors Whether to capture console errors
39+ * @param HubInterface $hub The current hub
40+ * @param bool $captureErrors Whether to capture console errors
4041 */
4142 public function __construct (HubInterface $ hub , bool $ captureErrors = true )
4243 {
@@ -60,7 +61,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
6061 }
6162
6263 if ($ input instanceof ArgvInput) {
63- $ scope ->setExtra ('Full command ' , (string ) $ input );
64+ $ scope ->setExtra ('Full command ' , (string )$ input );
6465 }
6566 }
6667
@@ -71,6 +72,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
7172 */
7273 public function handleConsoleTerminateEvent (ConsoleTerminateEvent $ event ): void
7374 {
75+ Logs::getInstance ()->flush ();
7476 $ this ->hub ->popScope ();
7577 }
7678
@@ -82,7 +84,7 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
8284 public function handleConsoleErrorEvent (ConsoleErrorEvent $ event ): void
8385 {
8486 $ this ->hub ->configureScope (function (Scope $ scope ) use ($ event ): void {
85- $ scope ->setTag ('console.command.exit_code ' , (string ) $ event ->getExitCode ());
87+ $ scope ->setTag ('console.command.exit_code ' , (string )$ event ->getExitCode ());
8688
8789 if ($ this ->captureErrors ) {
8890 $ hint = EventHint::fromArray ([
0 commit comments