Disable sensitive logs
- PII logs can only appear in VERBOSE level
- logSeverityStrToEnum() no more support VERBOSE level input, only
accept DEBUG, INFO, WARNING, and ERROR.
- developer can set DBG flag from code to have a debug build, the DEBUG
level is automatically promote to VERBOSE.
- uniform log format to [FILE NAME]: [FUNC NAME]: [MSG]
- move from ALOG to LOG on DnsProxyListener
- adjust severity for some logs
- correct print format on uint8_t type
Bug: 128736560
Test: builds, boots
Test: atest resolv_integration_test
Change-Id: I0ff03824901168165bbe1f5abae9ff3e74db63d6
diff --git a/resolv/res_query.cpp b/resolv/res_query.cpp
index 0f7b54e..fbbcc31 100644
--- a/resolv/res_query.cpp
+++ b/resolv/res_query.cpp
@@ -122,13 +122,13 @@
again:
hp->rcode = NOERROR; /* default */
- LOG(DEBUG) << ";; res_query(" << name << ", " << cl << ", " << type;
+ LOG(DEBUG) << __func__ << ": (" << cl << ", " << type << ")";
n = res_nmkquery(statp, QUERY, name, cl, type, NULL, 0, NULL, buf, sizeof(buf));
if (n > 0 && (statp->options & (RES_USE_EDNS0 | RES_USE_DNSSEC)) != 0U && !retried)
n = res_nopt(statp, n, buf, sizeof(buf), anslen);
if (n <= 0) {
- LOG(DEBUG) << ";; res_query: mkquery failed";
+ LOG(DEBUG) << __func__ << ": mkquery failed";
*herrno = NO_RECOVERY;
return n;
}
@@ -137,11 +137,11 @@
/* if the query choked with EDNS0, retry without EDNS0 */
if ((statp->options & (RES_USE_EDNS0 | RES_USE_DNSSEC)) != 0U &&
(statp->_flags & RES_F_EDNS0ERR) && !retried) {
- LOG(DEBUG) << ";; res_nquery: retry without EDNS0";
+ LOG(DEBUG) << __func__ << ": retry without EDNS0";
retried = true;
goto again;
}
- LOG(DEBUG) << ";; res_query: send error";
+ LOG(DEBUG) << __func__ << ": send error";
// Note that rcodes SERVFAIL, NOTIMP, REFUSED may cause res_nquery() to return a general
// error code EAI_AGAIN, but mapping the error code from rcode as res_queryN() does for
@@ -169,7 +169,7 @@
}
if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
- LOG(DEBUG) << ";; rcode = (" << p_rcode(hp->rcode)
+ LOG(DEBUG) << __func__ << ": rcode = (" << p_rcode(hp->rcode)
<< "), counts = an:" << ntohs(hp->ancount) << " ns:" << ntohs(hp->nscount)
<< " ar:" << ntohs(hp->arcount);
@@ -350,7 +350,7 @@
int n, d;
if (domain == NULL) {
- LOG(DEBUG) << ";; res_nquerydomain(" << name << ", <Nil>, " << cl << ", " << type << ")";
+ LOG(DEBUG) << __func__ << ": (null, " << cl << ", " << type << ")";
/*
* Check for trailing '.';
* copy without '.' if present.
@@ -367,8 +367,7 @@
} else
longname = name;
} else {
- LOG(DEBUG) << ";; res_nquerydomain(" << name << ", " << domain << ", " << cl << ", " << type
- << ")";
+ LOG(DEBUG) << __func__ << ": (" << cl << ", " << type << ")";
n = strlen(name);
d = strlen(domain);
if (n + d + 1 >= MAXDNAME) {