smtp: add tracing feature

Add `smtp` as tracing feature, use CURL_TRC_SMTP() in code to
trace operations.

Closes #14531
This commit is contained in:
Stefan Eissing 2024-08-13 13:49:07 +02:00 committed by Daniel Stenberg
parent 8058bbae52
commit 1c42ea4066
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 61 additions and 14 deletions

View file

@ -221,6 +221,24 @@ void Curl_trc_ftp(struct Curl_easy *data, const char *fmt, ...)
}
#endif /* !CURL_DISABLE_FTP */
#ifndef CURL_DISABLE_SMTP
struct curl_trc_feat Curl_trc_feat_smtp = {
"SMTP",
CURL_LOG_LVL_NONE,
};
void Curl_trc_smtp(struct Curl_easy *data, const char *fmt, ...)
{
DEBUGASSERT(!strchr(fmt, '\n'));
if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_smtp)) {
va_list ap;
va_start(ap, fmt);
trc_infof(data, &Curl_trc_feat_smtp, fmt, ap);
va_end(ap);
}
}
#endif /* !CURL_DISABLE_SMTP */
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
struct curl_trc_feat Curl_trc_feat_ws = {
"WS",
@ -258,6 +276,9 @@ static struct trc_feat_def trc_feats[] = {
#ifndef CURL_DISABLE_DOH
{ &Curl_doh_trc, TRC_CT_NETWORK },
#endif
#ifndef CURL_DISABLE_SMTP
{ &Curl_trc_feat_smtp, TRC_CT_PROTOCOL },
#endif
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
{ &Curl_trc_feat_ws, TRC_CT_PROTOCOL },
#endif