curl_log: evaluate log statement only when transfer is verbose

Closes #11238
This commit is contained in:
Stefan Eissing 2023-06-02 15:57:46 +02:00 committed by Daniel Stenberg
parent 93df7134b5
commit e054a16830
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 8 additions and 6 deletions

View File

@ -130,7 +130,7 @@ void Curl_log_cf_debug(struct Curl_easy *data, struct Curl_cfilter *cf,
const char *fmt, ...)
{
DEBUGASSERT(cf);
if(data && Curl_log_cf_is_debug(cf)) {
if(data && Curl_log_cf_is_debug(cf, data)) {
va_list ap;
int len;
char buffer[MAXINFO + 2];

View File

@ -74,7 +74,7 @@ void Curl_debug(struct Curl_easy *data, curl_infotype type,
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#define LOG_CF(data, cf, ...) \
do { if(Curl_log_cf_is_debug(cf)) \
do { if(Curl_log_cf_is_debug(cf, data)) \
Curl_log_cf_debug(data, cf, __VA_ARGS__); } while(0)
#else
#define LOG_CF Curl_log_cf_debug
@ -90,8 +90,10 @@ void Curl_log_cf_debug(struct Curl_easy *data, struct Curl_cfilter *cf,
const char *fmt, ...);
#endif
#define Curl_log_cf_is_debug(cf) \
((cf) && (cf)->cft->log_level >= CURL_LOG_DEBUG)
#define Curl_log_cf_is_debug(cf, data) \
((data) && (data)->set.verbose && \
(cf) && (cf)->cft->log_level >= CURL_LOG_DEBUG)
#else /* !DEBUGBUILD */
@ -110,11 +112,11 @@ void Curl_log_cf_debug(struct Curl_easy *data, struct Curl_cfilter *cf,
const char *fmt, ...);
#endif
#define Curl_log_cf_is_debug(x) ((void)(x), FALSE)
#define Curl_log_cf_is_debug(x,y) ((void)(x), (void)(y), FALSE)
#endif /* !DEBUGBUILD */
#define LOG_CF_IS_DEBUG(x) Curl_log_cf_is_debug(x)
#define LOG_CF_IS_DEBUG(cf, data) Curl_log_cf_is_debug(cf, data)
/* Macros intended for DEBUGF logging, use like:
* DEBUGF(infof(data, CFMSG(cf, "this filter %s rocks"), "very much"));