Пример #1
0
 protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
 {
     if ($input->hasParameterOption(['--log', '-l']) && $command instanceof \App\Command) {
         $logPath = $input->getParameterOption(['--log', '-l']);
         $logDir = realpath(dirname($logPath));
         if (!$logDir) {
             throw new \InvalidArgumentException(sprintf('Log folder does not exist! %s', $logDir));
         }
         $log = new Logger('depipe');
         $log->pushHandler(new StreamHandler($logPath));
         $command->setLogger($log);
         $this->logger = $command;
     }
     parent::doRunCommand($command, $input, $output);
 }