[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log

pull/36711/head
tanvi-jagtap 12 months ago
parent cfd8f914bc
commit e208603d68
  1. 12
      src/cpp/server/load_reporter/load_data_store.cc

@ -111,9 +111,8 @@ std::string LoadRecordKey::GetClientIpBytes() const {
} else if (client_ip_hex_.size() == kIpv4AddressLength) { } else if (client_ip_hex_.size() == kIpv4AddressLength) {
uint32_t ip_bytes; uint32_t ip_bytes;
if (sscanf(client_ip_hex_.c_str(), "%x", &ip_bytes) != 1) { if (sscanf(client_ip_hex_.c_str(), "%x", &ip_bytes) != 1) {
gpr_log(GPR_ERROR, LOG(ERROR) << "Can't parse client IP (" << client_ip_hex_
"Can't parse client IP (%s) from a hex string to an integer.", << ") from a hex string to an integer.";
client_ip_hex_.c_str());
return ""; return "";
} }
ip_bytes = grpc_htonl(ip_bytes); ip_bytes = grpc_htonl(ip_bytes);
@ -124,10 +123,9 @@ std::string LoadRecordKey::GetClientIpBytes() const {
for (size_t i = 0; i < 4; ++i) { for (size_t i = 0; i < 4; ++i) {
if (sscanf(client_ip_hex_.substr(i * 8, (i + 1) * 8).c_str(), "%x", if (sscanf(client_ip_hex_.substr(i * 8, (i + 1) * 8).c_str(), "%x",
ip_bytes + i) != 1) { ip_bytes + i) != 1) {
gpr_log( LOG(ERROR) << "Can't parse client IP part ("
GPR_ERROR, << client_ip_hex_.substr(i * 8, (i + 1) * 8)
"Can't parse client IP part (%s) from a hex string to an integer.", << ") from a hex string to an integer.";
client_ip_hex_.substr(i * 8, (i + 1) * 8).c_str());
return ""; return "";
} }
ip_bytes[i] = grpc_htonl(ip_bytes[i]); ip_bytes[i] = grpc_htonl(ip_bytes[i]);

Loading…
Cancel
Save