Monolog\Logger::popProcessor PHP Method

popProcessor() public method

Removes the processor on top of the stack and returns it.
public popProcessor ( ) : callable
return callable
    public function popProcessor()
    {
        if (!$this->processors) {
            throw new \LogicException('You tried to pop from an empty processor stack.');
        }
        return array_shift($this->processors);
    }

Usage Example

Beispiel #1
0
 public function work()
 {
     $identity = $this->identify();
     $this->logger->notice(sprintf('%s waiting for work on queue(s) [%s]', $identity, join(', ', $this->queues)));
     for (;;) {
         $job = $this->metro->pop($this->queues, $this);
         if (null !== $job) {
             $jobHandler = $this->metro->createTaskLogHander($job->getId());
             $this->logger->pushHandler($jobHandler);
             $this->logger->pushProcessor(function ($record) use($job) {
                 $record['extra']['job_id'] = $job->getId();
                 return $record;
             });
             $this->workOn($job, $jobHandler);
             $this->logger->popHandler();
             $this->logger->popProcessor();
         }
         if ($this->interval <= 0) {
             return;
         }
         if (null === $job) {
             if ($this->drainMode) {
                 $this->logger->notice(sprintf('%s exiting because all queues are empty', $identity));
                 return;
             }
             usleep($this->interval * 1000.0);
         }
     }
 }
All Usage Examples Of Monolog\Logger::popProcessor