setFormatter($this->container->get($formatter)); } catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) { $this->logger->error($exception->getMessage(), ['exception' => $exception, 'handlerData' => $handlerData]); continue; } } elseif ($handlerData['handler'] === Incoviba\Common\Implement\Log\Handler\MySQL::class) { try { $params = [ $this->container->get(Incoviba\Common\Define\Connection::class) ]; $formatter = Incoviba\Common\Implement\Log\Formatter\PDO::class; if (array_key_exists('formatter', $handlerData)) { $formatter = $handlerData['formatter']; } $handler = new $handlerData['handler'](...$params) ->setFormatter($this->container->get($formatter)); } catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) { $this->logger->error($exception->getMessage(), ['exception' => $exception, 'handlerData' => $handlerData]); continue; } } elseif ($handlerData['handler'] === Handler\RedisHandler::class) { try { $params = [ $this->container->get(Predis\ClientInterface::class), "logs:{$handlerData['name']}" ]; } catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) { $this->logger->error($exception->getMessage(), ['exception' => $exception, 'handlerData' => $handlerData]); continue; } $handler = new $handlerData['handler'](...$params); } if (!isset($handler)) { $this->logger->error("Invalid handler", ['handlerData' => $handlerData]); continue; } $params = [ $handler, ]; if (is_array($handlerData['levels'])) { foreach ($handlerData['levels'] as $level) { $params []= $level; } } else { $params []= $handlerData['levels']; $params []= Level::Emergency; } $params []= false; $handlers []= new Handler\FilterHandler(...$params); } return $handlers; } }