protected function logHttp(Client $client, OutputInterface $output)
    {
        $guzzle = $client->getHttpClient();
        if (OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity()) {
            $logger = function ($message) use ($output) {
                $finfo = new \finfo(FILEINFO_MIME);
                $msg = ('text' == substr($finfo->buffer($message), 0, 4)) ? $message : '(binary string)';
                $output->writeln('<info>Guzzle</info> ' . $msg);
            };
            $logAdapter = new ClosureLogAdapter($logger);
            $logPlugin = new LogPlugin($logAdapter, MessageFormatter::DEBUG_FORMAT);
            $guzzle->addSubscriber($logPlugin);
        }
    }