Example #1
0
 /**
  * sub process run
  */
 public function run()
 {
     $this->reader->open();
     while (true) {
         $line = $this->reader->read();
         if ($line === false) {
             usleep(200);
             continue;
         }
         if ($this->filter->filter($line)) {
             $message = $this->filter->getErrorMessage($line, $this->reader);
             $this->notify->send($this->reader->info(), $message);
         }
     }
 }
Example #2
0
 /**
  * get more ten lines
  * @param $data
  * @param ReaderInterface $reader
  * @return string
  */
 public function getErrorMessage($data, ReaderInterface $reader)
 {
     $message = $data;
     $max_line = 10;
     for ($i = 0; $i < $max_line; $i++) {
         $message .= $reader->read();
     }
     return $message;
 }