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/getaddrinfo.cpp b/resolv/getaddrinfo.cpp
index 0a657df..b2429aa 100644
--- a/resolv/getaddrinfo.cpp
+++ b/resolv/getaddrinfo.cpp
@@ -361,7 +361,7 @@
if (tmp.ai_socktype == ANY && ex.e_socktype != ANY) tmp.ai_socktype = ex.e_socktype;
if (tmp.ai_protocol == ANY && ex.e_protocol != ANY) tmp.ai_protocol = ex.e_protocol;
- LOG(DEBUG) << "explore_numeric: ai_family=" << tmp.ai_family
+ LOG(DEBUG) << __func__ << ": explore_numeric: ai_family=" << tmp.ai_family
<< " ai_socktype=" << tmp.ai_socktype << " ai_protocol=" << tmp.ai_protocol;
if (hostname == nullptr)
error = explore_null(&tmp, servname, &cur->ai_next);
@@ -409,7 +409,7 @@
if (tmp.ai_socktype == ANY && ex.e_socktype != ANY) tmp.ai_socktype = ex.e_socktype;
if (tmp.ai_protocol == ANY && ex.e_protocol != ANY) tmp.ai_protocol = ex.e_protocol;
- LOG(DEBUG) << "explore_fqdn(): ai_family=" << tmp.ai_family
+ LOG(DEBUG) << __func__ << ": explore_fqdn(): ai_family=" << tmp.ai_family
<< " ai_socktype=" << tmp.ai_socktype << " ai_protocol=" << tmp.ai_protocol;
error = explore_fqdn(&tmp, hostname, servname, &cur->ai_next, netcontext);
@@ -478,6 +478,8 @@
struct addrinfo sentinel;
int error;
+ LOG(DEBUG) << __func__;
+
assert(pai != NULL);
/* servname may be NULL */
assert(res != NULL);
@@ -589,6 +591,8 @@
const char *cp, *scope, *addr;
struct sockaddr_in6* sin6;
+ LOG(DEBUG) << __func__;
+
assert(pai != NULL);
/* hostname may be NULL */
/* servname may be NULL */
@@ -936,9 +940,8 @@
}
} else if (type != qtype) {
if (type != T_KEY && type != T_SIG)
- LOG(DEBUG) << __func__ << "(getanswer): asked for \"" << qname << " "
- << p_class(C_IN) << " " << p_type(qtype) << "\", got type \""
- << p_type(type) << "\"";
+ LOG(DEBUG) << __func__ << ": asked for \"" << qname << " " << p_class(C_IN) << " "
+ << p_type(qtype) << "\", got type \"" << p_type(type) << "\"";
cp += n;
continue; /* XXX - had_error++ ? */
}
@@ -946,8 +949,8 @@
case T_A:
case T_AAAA:
if (strcasecmp(canonname, bp) != 0) {
- LOG(DEBUG) << __func__ << "(getanswer): asked for \"" << canonname
- << "\", got \"" << bp << "\"";
+ LOG(DEBUG) << __func__ << ": asked for \"" << canonname << "\", got \"" << bp
+ << "\"";
cp += n;
continue; /* XXX - had_error++ ? */
}
@@ -1589,7 +1592,7 @@
answer = t->answer;
anslen = t->anslen;
- LOG(DEBUG) << __func__ << "(" << name << ", " << cl << ", " << type << ")";
+ LOG(DEBUG) << __func__ << ": (" << cl << ", " << type << ")";
n = res_nmkquery(res, QUERY, name, cl, type, NULL, 0, NULL, buf, sizeof(buf));
if (n > 0 && (res->options & (RES_USE_EDNS0 | RES_USE_DNSSEC)) != 0 && !retried)
@@ -1790,8 +1793,6 @@
assert(name != NULL);
- LOG(DEBUG) << __func__ << "(\"" << name << "\", " << (domain ? domain : "<null>") << ")";
-
if (domain == NULL) {
// Check for trailing '.'; copy without '.' if present.
n = strlen(name);