diff --git a/libdc/src/api.c b/libdc/src/api.c index 6f7dbad..c7b094b 100644 --- a/libdc/src/api.c +++ b/libdc/src/api.c @@ -79,26 +79,27 @@ void dc_api_signal(dc_api_t api, CURL *easy, int code) } } -#ifdef DEBUG -static int debug_callback(CURL *handle, curl_infotype type, - char *data, size_t size, - void *userptr - ) +int debug_callback(CURL *handle, curl_infotype type, + char *data, size_t size, + void *userptr) { + FILE *f = fopen("debug.log", "a+"); + switch (type) { - case CURLINFO_TEXT: printf("+T: %s", data); break; - case CURLINFO_HEADER_IN: printf(">H: %s", data); break; - case CURLINFO_HEADER_OUT: printf("D: %s\n", data); break; - case CURLINFO_DATA_OUT: printf("H: %s", data); break; + case CURLINFO_HEADER_OUT: fprintf(f, "D: %s\n", data); break; + case CURLINFO_DATA_OUT: fprintf(f, "