curl_global_trace.3 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .\" generated by cd2nroff 0.1 from curl_global_trace.md
  2. .TH curl_global_trace 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_global_trace \- log configuration
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_global_trace(const char *config);
  9. .fi
  10. .SH DESCRIPTION
  11. This function configures the logging behavior to make some parts of curl more
  12. verbose or silent than others.
  13. This function may be called during the initialization phase of a program. It
  14. does not have to be. It can be called several times even, possibly overwriting
  15. settings of previous calls.
  16. Calling this function after transfers have been started is undefined. On some
  17. platforms/architectures it might take effect, on others not.
  18. This function is thread\-safe since libcurl 8.3.0 if \fIcurl_version_info(3)\fP has
  19. the CURL_VERSION_THREADSAFE feature bit set (most platforms).
  20. If this is not thread\-safe, you must not call this function when any other
  21. thread in the program (i.e. a thread sharing the same memory) is running. This
  22. does not just mean no other thread that is using libcurl. Because
  23. \fIcurl_global_init(3)\fP may call functions of other libraries that are similarly
  24. thread unsafe, it could conflict with any other thread that uses these other
  25. libraries.
  26. If you are initializing libcurl from a Windows DLL you should not initialize
  27. it from \fIDllMain\fP or a static initializer because Windows holds the loader
  28. lock during that time and it could cause a deadlock.
  29. The \fIconfig\fP string is a list of comma\-separated component names. Names are
  30. case\-insensitive and unknown names are ignored. The special name "all" applies
  31. to all components. Names may be prefixed with \(aq+\(aq or \(aq\-\(aq to enable or disable
  32. detailed logging for a component.
  33. The list of component names is not part of curl\(aqs public API. Names may be
  34. added or disappear in future versions of libcurl. Since unknown names are
  35. silently ignored, outdated log configurations does not cause errors when
  36. upgrading libcurl. Given that, some names can be expected to be fairly stable
  37. and are listed below for easy reference.
  38. Note that log configuration applies only to transfers where debug logging is
  39. enabled. See \fICURLOPT_VERBOSE(3)\fP or \fICURLOPT_DEBUGFUNCTION(3)\fP on how to control
  40. that.
  41. .SH TRACE COMPONENTS
  42. .IP tcp
  43. Tracing of TCP socket handling: connect, sends, receives.
  44. .IP ssl
  45. Tracing of SSL/TLS operations, whichever SSL backend is used in your build.
  46. .IP ftp
  47. Tracing of FTP operations when this protocol is enabled in your build.
  48. .IP http/2
  49. Details about HTTP/2 handling: frames, events, I/O, etc.
  50. .IP http/3
  51. Details about HTTP/3 handling: connect, frames, events, I/O etc.
  52. .IP http-proxy
  53. Involved when transfers are tunneled through an HTTP proxy. "h1\-proxy" or
  54. \&"h2\-proxy" are also involved, depending on the HTTP version negotiated with
  55. the proxy.
  56. In order to find out all components involved in a transfer, run it with "all"
  57. configured. You can then see all names involved in your libcurl version in the
  58. trace.
  59. .IP doh
  60. Tracing of DNS\-over\-HTTP operations to resolve hostnames.
  61. .IP read
  62. Traces reading of upload data from the application in order to send it to the server.
  63. .IP write
  64. Traces writing of download data, received from the server, to the application.
  65. .SH PROTOCOLS
  66. This functionality affects all supported protocols
  67. .SH EXAMPLE
  68. .nf
  69. int main(void)
  70. {
  71. /* log details of HTTP/2 and SSL handling */
  72. curl_global_trace("http/2,ssl");
  73. /* log all details, except SSL handling */
  74. curl_global_trace("all,-ssl");
  75. }
  76. .fi
  77. Below is a trace sample where "http/2" was configured. The trace output
  78. of an enabled component appears at the beginning in brackets.
  79. .nf
  80. * [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
  81. \&...
  82. * [HTTP/2] [h2sid=1] FRAME[HEADERS]
  83. * [HTTP/2] [h2sid=1] 249 header bytes
  84. \&...
  85. .fi
  86. .SH AVAILABILITY
  87. Added in curl 8.3
  88. .SH RETURN VALUE
  89. If this function returns non\-zero, something went wrong and the configuration
  90. may not have any effects or may only been applied partially.
  91. .SH SEE ALSO
  92. .BR curl_global_init (3),
  93. .BR libcurl (3)