protected function createMonologDriver(array $config): LoggerInterface
    {
        if ($this->container === null) {
            throw new RuntimeException('No container instance was found.');
        }

        $config['name'] = $config['original_name'];

        unset($config['original_name']);

        if ($this->container->has($config['handler'])) {
            $handler = $this->container->get($config['handler']);

            if (! \is_a($handler, HandlerInterface::class, true)) {
                throw new InvalidArgumentException(\sprintf('[%s] must be an instance of [%s]', $config['handler'], HandlerInterface::class));
            }
        } else {
            throw new InvalidArgumentException(\sprintf('Handler [%s] is not managed by the container.', $config['handler']));
        }

        if (! isset($config['formatter'])) {
            $handler->setFormatter($this->getConfiguredLineFormatter());
        } elseif ($config['formatter'] !== 'default') {
            $handler->setFormatter($this->container->get($config['formatter']));
        }

        $monolog = new Monolog($this->parseChannel($config));

        $monolog->pushHandler($handler);

        return $monolog;
    }