示例#1
0
 /**
  * {@inheritdoc}
  */
 function process()
 {
     if (1 & ($arg = (int) $this->getParam(1))) {
         // Emulate terminating
         $signo = $arg % 4 > 1 ? SIGTERM : SIGKILL;
         if ($this->debug) {
             $signame = Base::getSignalName($signo);
             $this->debug("TEST: Emulate terminating with {$signame} ({$signo})");
         }
         $this->sendSignalToChild($signo);
     }
     return parent::process();
 }
示例#2
0
 /**
  * Debug logging
  *
  * @param string $message
  */
 protected function debug($message)
 {
     if (!$this->debug) {
         return;
     }
     $time = Base::getTimeForLog();
     $poolId = $this->id;
     $poolName = $this->poolName;
     $pid = posix_getpid();
     $message = "<small>{$time} [debug] [P{$poolId}.{$poolName}] " . "#{$pid}:</> <info>{$message}</>";
     if (class_exists('Aza\\Kernel\\Core', false) && ($app = Core::$app)) {
         // @codeCoverageIgnoreStart
         // TODO: Event dispatcher call for debug message?
         $app->msg($message, Logger::LVL_DEBUG);
     } else {
         // @codeCoverageIgnoreEnd
         echo preg_replace('~<(?:/?[a-z][a-z0-9_=;-]+|/)>~Si', '', $message) . PHP_EOL;
         @ob_flush();
         @flush();
     }
 }