cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to output verbose to file?

From: Ryan Wilcox <ryanwilcox_at_mac.com>
Date: Fri, 13 Aug 2004 12:46:39 -0400

On 8/14/04, at 1:28 AM, nkb said:

>So, how do I see the verbose
>result from within my program?

Pasted straight from some production code (although abstracted a bit from
straight libcurl it should help)

    int wxcurl_stderr_stream_write (CURL * crlptr , curl_infotype info, char *
cStrMessage, size_t msgSize, void * buffer)
    {
        switch (info) {
          case CURLINFO_TEXT:
                out << "Text: " << message; break;
          case CURLINFO_HEADER_IN:
                out << "Header in: " << message; break;
          case CURLINFO_HEADER_OUT:
                out << "Header out: " << message; break;
          case CURLINFO_DATA_IN:
                out << "Data in: " << message; break;
          case CURLINFO_DATA_OUT:
                out << "Data out: " << message; break;
          case CURLINFO_END:
                out << "End: " << message; break;
          case CURLINFO_SSL_DATA_IN:
                out << "SSL Data in: " << message; break;
          case CURLINFO_SSL_DATA_OUT:
                out << "SSL Data out: " << message; break;
        }
        
        return 0;
    }

void yourFunctionThatWantsToGetVerboseOutput()
{

    ..your stuff here..

    SetOpt( CURLOPT_VERBOSE, TRUE );
    SetOpt( CURLOPT_DEBUGFUNCTION, wxcurl_stderr_stream_write );
    SetOpt( CURLOPT_DEBUGDATA, (void*) m_verbStream );
}

Hope this helps,
_Ryan Wilcox

================================================================
Wilcox Development Solutions: http://www.wilcoxd.com
Toolsmiths for the Internet Age PGP: 0x2F4E9C31
Received on 2004-08-13