1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_global_trace 5Section: 3 6Source: libcurl 7See-also: 8 - curl_global_init (3) 9 - libcurl (3) 10Protocol: 11 - All 12--- 13 14# NAME 15 16curl_global_trace - log configuration 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_global_trace(const char *config); 24~~~ 25 26# DESCRIPTION 27 28This function configures the logging behavior to make some parts of curl more 29verbose or silent than others. 30 31This function may be called during the initialization phase of a program. It 32does not have to be. It can be called several times even, possibly overwriting 33settings of previous calls. 34 35Calling this function after transfers have been started is undefined. On some 36platforms/architectures it might take effect, on others not. 37 38This function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has 39the CURL_VERSION_THREADSAFE feature bit set (most platforms). 40 41If this is not thread-safe, you must not call this function when any other 42thread in the program (i.e. a thread sharing the same memory) is running. This 43does not just mean no other thread that is using libcurl. Because 44curl_global_init(3) may call functions of other libraries that are similarly 45thread unsafe, it could conflict with any other thread that uses these other 46libraries. 47 48If you are initializing libcurl from a Windows DLL you should not initialize 49it from *DllMain* or a static initializer because Windows holds the loader 50lock during that time and it could cause a deadlock. 51 52The *config* string is a list of comma-separated component names. Names are 53case-insensitive and unknown names are ignored. The special name "all" applies 54to all components. Names may be prefixed with '+' or '-' to enable or disable 55detailed logging for a component. 56 57The list of component names is not part of curl's public API. Names may be 58added or disappear in future versions of libcurl. Since unknown names are 59silently ignored, outdated log configurations does not cause errors when 60upgrading libcurl. Given that, some names can be expected to be fairly stable 61and are listed below for easy reference. 62 63Note that log configuration applies only to transfers where debug logging is 64enabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control 65that. 66 67# TRACE COMPONENTS 68 69## `tcp` 70 71Tracing of TCP socket handling: connect, sends, receives. 72 73## `ssl` 74 75Tracing of SSL/TLS operations, whichever SSL backend is used in your build. 76 77## `ftp` 78 79Tracing of FTP operations when this protocol is enabled in your build. 80 81## `http/2` 82 83Details about HTTP/2 handling: frames, events, I/O, etc. 84 85## `http/3` 86 87Details about HTTP/3 handling: connect, frames, events, I/O etc. 88 89## `http-proxy` 90 91Involved when transfers are tunneled through an HTTP proxy. "h1-proxy" or 92"h2-proxy" are also involved, depending on the HTTP version negotiated with 93the proxy. 94 95In order to find out all components involved in a transfer, run it with "all" 96configured. You can then see all names involved in your libcurl version in the 97trace. 98 99## `doh` 100 101Tracing of DNS-over-HTTP operations to resolve hostnames. 102 103## `read` 104 105Traces reading of upload data from the application in order to send it to the server. 106 107## `write` 108 109Traces writing of download data, received from the server, to the application. 110 111# EXAMPLE 112 113~~~c 114int main(void) 115{ 116 /* log details of HTTP/2 and SSL handling */ 117 curl_global_trace("http/2,ssl"); 118 119 /* log all details, except SSL handling */ 120 curl_global_trace("all,-ssl"); 121} 122~~~ 123 124Below is a trace sample where "http/2" was configured. The trace output 125of an enabled component appears at the beginning in brackets. 126~~~ 127* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/ 128... 129* [HTTP/2] [h2sid=1] FRAME[HEADERS] 130* [HTTP/2] [h2sid=1] 249 header bytes 131... 132~~~ 133 134# AVAILABILITY 135 136Added in 8.3 137 138# RETURN VALUE 139 140If this function returns non-zero, something went wrong and the configuration 141may not have any effects or may only been applied partially. 142