public function registerEvents(EventManagerContract $eventManager): void
    {
        // Before a command is executed, the handler gets activated and the console output
        // is set in order to know where to write the logs.
        $eventManager->attach(
            ConsoleEvents::COMMAND,
            function (ConsoleCommandEvent $event): void {
                $output = $event->getOutput();

                if ($output instanceof ConsoleOutputInterface) {
                    $output = $output->getErrorOutput();
                }

                $this->setOutput($output);
            },
            255
        );

        // After a command has been executed, it disables the output.
        $eventManager->attach(
            ConsoleEvents::TERMINATE,
            function (): void {
                $this->close();
            },
            -255
        );
    }
public function registerEvents(EventManagerContract $eventManager): void
    {
        // Before a command is executed, the handler gets activated and the console output
        // is set in order to know where to write the logs.
        $eventManager->attach(
            ConsoleEvents::COMMAND,
            function (ConsoleCommandEvent $event): void {
                $output = $event->getOutput();

                if ($output instanceof ConsoleOutputInterface) {
                    $output = $output->getErrorOutput();
                }

                $this->setOutput($output);
            },
            255
        );

        // After a command has been executed, it disables the output.
        $eventManager->attach(
            ConsoleEvents::TERMINATE,
            function (): void {
                $this->close();
            },
            -255
        );
    }
public function registerEvents ( EventManagerContract $ eventManager ) : void { // Before a command is executed, the handler gets activated and the console output // is set in order to know where to write the logs. $ eventManager -> attach ( ConsoleEvents :: COMMAND , function ( ConsoleCommandEvent $ event ) : void { $ output = $ event -> getOutput ( ) ; if ( $ output instanceof ConsoleOutputInterface ) { $ output = $ output -> getErrorOutput ( ) ; } $ this -> setOutput ( $ output ) ; } , 255 ) ; // After a command has been executed, it disables the output. $ eventManager -> attach ( ConsoleEvents :: TERMINATE , function ( ) : void { $ this -> close ( ) ; } , - 255 ) ; }
Register needed events to event manager.

@param \Viserio\Component\Contract\Events\EventManager $eventManager

@return void
Register needed events to event manager .