Beispiel #1
0
 /**
  * Show log, passthru multitail
  *
  * @param  array           $logList    List of log files
  * @param  InputInterface  $input      Input instance
  * @param  OutputInterface $output     Output instance
  * @param  string          $grep       Grep value
  * @param  array           $optionList Additional option list for multitail
  *
  * @return int|null|void
  * @throws \Exception
  */
 protected function showLog($logList, $input, $output, $grep = null, $optionList = null)
 {
     $this->elevateProcess($input, $output);
     // check if logfiles are accessable
     foreach ($logList as $log) {
         if (!is_readable($log)) {
             $output->writeln('<p-error>Can\'t read ' . $log . '</p-error>');
             return 1;
         }
     }
     $output->writeln('<p>Reading logfile with multitail</p>');
     $command = new CommandBuilder('multitail', '--follow-all');
     // Add grep
     if ($grep !== null) {
         $command->addArgumentTemplate('-E %s', $grep);
     }
     // Add log
     $command->addArgumentList($logList);
     $command->executeInteractive();
     return 0;
 }