-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improved debug logging for cfilters #10271
Conversation
case CURLINFO_HEADER_OUT: | ||
case CURLINFO_HEADER_IN: | ||
fwrite(s_infotype[type], 2, 1, data->set.err); | ||
fwrite(ptr, size, 1, data->set.err); |
Check failure
Code scanning / CodeQL
Cleartext storage of sensitive information in file
…ons. - new functions and macros for cfilter debugging - set CURL_DEBUG with names of cfilters where debug logging should be enabled - use GNUC __attribute__ to enable printf format checks during compile
…se non-C99, non-debug builds.
…such calls in non-debug mode.
CF_DEBUGF(infof(data, CFMSG(cf, "recv(len=%zu) -> %d, err=%d"), | ||
len, (int)nread, *err)); | ||
DEBUGF(LOG_CF(data, cf, "recv(len=%zu) -> %d, err=%d", len, (int)nread, | ||
*err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate why this may be necessary temporarily, and useful, but even for me this is sometimes too verbose. It looks like this PR is going to change CF logging so that it cannot be disabled on DEBUGBUILDs any longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theses statements will not produce output, unless you enable the logging for a certain cfilter type.
CURL_DEBUG=tcp curl -v url
will enable the logging of the 'TCP' socket cfilter.
The idea here is to have logging available, should you wish, without recompiling the debug-enabled curl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat. We will need documentation explaining how it works.
Thanks! |
- new functions and macros for cfilter debugging - set CURL_DEBUG with names of cfilters where debug logging should be enabled - use GNUC __attribute__ to enable printf format checks during compile Closes curl#10271
New curl_log.[ch] to keep failf/infof and debug logging implementations.
Usage on a debug build:
Tried to make the macros performant and work for all compilers. Let's see what CI says.