write debug log to file
This commit is contained in:
parent
91bdd23a72
commit
f6ca0791a9
@ -79,26 +79,27 @@ void dc_api_signal(dc_api_t api, CURL *easy, int code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
int debug_callback(CURL *handle, curl_infotype type,
|
||||||
static int debug_callback(CURL *handle, curl_infotype type,
|
|
||||||
char *data, size_t size,
|
char *data, size_t size,
|
||||||
void *userptr
|
void *userptr)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
FILE *f = fopen("debug.log", "a+");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CURLINFO_TEXT: printf("+T: %s", data); break;
|
case CURLINFO_TEXT: fprintf(f, "+T: %s", data); break;
|
||||||
case CURLINFO_HEADER_IN: printf(">H: %s", data); break;
|
case CURLINFO_HEADER_IN: fprintf(f, ">H: %s", data); break;
|
||||||
case CURLINFO_HEADER_OUT: printf("<H: %s", data); break;
|
case CURLINFO_HEADER_OUT: fprintf(f, "<H: %s", data); break;
|
||||||
case CURLINFO_DATA_IN: printf(">D: %s\n", data); break;
|
case CURLINFO_DATA_IN: fprintf(f, ">D: %s\n", data); break;
|
||||||
case CURLINFO_DATA_OUT: printf("<D: %s\n", data); break;
|
case CURLINFO_DATA_OUT: fprintf(f, "<D: %s\n", data); break;
|
||||||
case CURLINFO_SSL_DATA_IN:
|
case CURLINFO_SSL_DATA_IN: fprintf(f, "<S: SSL_DATA_IN\n"); break;
|
||||||
case CURLINFO_SSL_DATA_OUT:
|
case CURLINFO_SSL_DATA_OUT: fprintf(f, "<S: SSL_DATA_OUT\n"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static dc_api_sync_t
|
static dc_api_sync_t
|
||||||
dc_api_do(dc_api_t api, char const *verb,
|
dc_api_do(dc_api_t api, char const *verb,
|
||||||
|
Loading…
Reference in New Issue
Block a user