Exemplo n.º 1
0
 /**
  * Resolve processors for that Logger (if any provided) against an array of previously set
  * up processors.
  *
  * @throws InvalidArgumentException if a requested processor is not available in $processors
  *
  * @param  array $loggerOptions array of logger options
  * @param  callable[] $processors Available Processors to resolve against
  * @return callable[] Array of Monolog processors
  */
 public function resolveProcessors(array $loggerOptions, $processors)
 {
     $processorArray = array();
     if (isset($loggerOptions['processors'])) {
         // If processors have been specified and, they do exist in the provided processors array
         // We return an array of processor objects
         foreach ($loggerOptions['processors'] as $processorId) {
             if (isset($processors[$processorId])) {
                 $processorArray[] = $processors[$processorId];
             } else {
                 throw new \InvalidArgumentException(sprintf('Cannot add processor "%s" to the logger "%s". Processor not found.', $processorId, $this->logger->getName()));
             }
         }
     }
     // If nothing is set there is nothing to resolve, Processors will be Monolog's default
     return $processorArray;
 }