1212namespace Symfony \Component \Messenger \Command ;
1313
1414use Psr \Container \ContainerInterface ;
15+ use Psr \Log \LoggerInterface ;
1516use Symfony \Component \Console \Command \Command ;
1617use Symfony \Component \Console \Input \InputArgument ;
1718use Symfony \Component \Console \Input \InputInterface ;
@@ -34,13 +35,15 @@ class ConsumeMessagesCommand extends Command
3435
3536 private $ bus ;
3637 private $ receiverLocator ;
38+ private $ logger ;
3739
38- public function __construct (MessageBusInterface $ bus , ContainerInterface $ receiverLocator )
40+ public function __construct (MessageBusInterface $ bus , ContainerInterface $ receiverLocator, LoggerInterface $ logger = null )
3941 {
4042 parent ::__construct ();
4143
4244 $ this ->bus = $ bus ;
4345 $ this ->receiverLocator = $ receiverLocator ;
46+ $ this ->logger = $ logger ;
4447 }
4548
4649 /**
@@ -86,11 +89,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
8689 }
8790
8891 if ($ limit = $ input ->getOption ('limit ' )) {
89- $ receiver = new MaximumCountReceiver ($ receiver , $ limit );
92+ $ receiver = new MaximumCountReceiver ($ receiver , $ limit, $ this -> logger );
9093 }
9194
9295 if ($ memoryLimit = $ input ->getOption ('memory-limit ' )) {
93- $ receiver = new MemoryLimitReceiver ($ receiver , $ memoryLimit );
96+ $ receiver = new MemoryLimitReceiver ($ receiver , $ memoryLimit, $ this -> logger );
9497 }
9598
9699 $ worker = new Worker ($ receiver , $ this ->bus );
0 commit comments