/** * {@inheritdoc} */ public function pushProcessor(callable $callback) : HandlerInterface { if ($this->handler instanceof ProcessableHandlerInterface) { $this->handler->pushProcessor($callback); return $this; } throw new \LogicException('The wrapped handler does not implement ' . ProcessableHandlerInterface::class); }
/** * @param HandlerInterface $handler */ public function injectProcessors($handler) { if (!empty($this->creationOptions['tags'])) { $tagProcessor = new TagProcessor($this->creationOptions['tags']); $handler->pushProcessor($tagProcessor); } if (empty($this->creationOptions['processors'])) { return; } foreach ($this->creationOptions['processors'] as $processor) { if (is_string($processor)) { /** @var callable $processor */ $processor = $this->getServiceLocator()->get("monolog.processor.{$processor}"); } $handler->pushProcessor($processor); } }
/** * Sets formatter and processors. * * @param HandlerInterface $handler * @return HandlerInterface */ protected function initHandler(HandlerInterface $handler) { if ($this->formatter != null) { $handler->setFormatter($this->formatter); } foreach ($this->processors as $processor) { $handler->pushProcessor($processor); } return $handler; }
/** * {@inheritdoc} */ public function pushProcessor($callback) { $this->handler->pushProcessor($callback); return $this; }
/** * Parse Processor. * * @param \Monolog\Handler\HandlerInterface $handler * @param array|object|null $processors * * @return \Monolog\Handler\HandlerInterface */ protected function parseProcessor(HandlerInterface $handler, $processors = null) : HandlerInterface { if ($processors === null) { return $handler; } if (is_array($processors)) { foreach ($processors as $processor => $settings) { $handler->pushProcessor(new $processor($settings)); } } elseif (is_object($processors)) { $handler->pushProcessor($processors); } return $handler; }
/** * @override * @inheritDoc */ public function pushProcessor($callback) { return $this->model->pushProcessor($callback); }
public function pushProcessor($callback) { return $this->delegate->pushProcessor($callback); }
private function setProcessorsToHandlerFromConfig(array $processors, HandlerInterface $handlerInstance) { foreach ($processors as $processor) { if (is_array($processor)) { $class = $processor['class']; $args = $processor['args']; } else { $class = $processor; $args = []; } $reflectionClass = new ReflectionClass($class); $processorInstance = $reflectionClass->newInstanceArgs($args); $handlerInstance->pushProcessor($processorInstance); } }