protected function createMonologDriver(array $config)
    {
        if (!is_a($config['handler'], HandlerInterface::class, true)) {
            throw new InvalidArgumentException(
                $config['handler'] . ' must be an instance of ' . HandlerInterface::class
            );
        }

        return new Monolog(
            $this->parseChannel($config), [$this->prepareHandler(
                $this->app->make($config['handler'], $config['with'] ?? []), $config
            )]
        );
    }