[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36575)

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

In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping
1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :
1. If the above mapping is correct.
2. The content of the log is as before.

gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36575

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36575 from tanvi-jagtap:test_core_e2e_all ef6f23db8c
PiperOrigin-RevId: 632669009
pull/36580/head^2
Tanvi Jagtap 8 months ago committed by Copybara-Service
parent 88a75b3914
commit e5cd63f971
  1. 27
      test/core/end2end/BUILD
  2. 19
      test/core/end2end/bad_server_response_test.cc
  3. 8
      test/core/end2end/connection_refused_test.cc
  4. 15
      test/core/end2end/cq_verifier.cc
  5. 27
      test/core/end2end/dualstack_socket_test.cc
  6. 7
      test/core/end2end/end2end_tests.cc
  7. 8
      test/core/end2end/fixtures/http_proxy_fixture.cc
  8. 6
      test/core/end2end/fixtures/proxy.cc
  9. 2
      test/core/end2end/fuzzers/BUILD
  10. 3
      test/core/end2end/fuzzers/fuzzing_common.cc
  11. 4
      test/core/end2end/fuzzers/network_input.cc
  12. 7
      test/core/end2end/goaway_server_test.cc
  13. 3
      test/core/end2end/grpc_core_end2end_test.bzl
  14. 6
      test/core/end2end/h2_ssl_cert_test.cc
  15. 44
      test/core/end2end/invalid_call_argument_test.cc
  16. 6
      test/core/end2end/no_server_test.cc
  17. 14
      test/core/end2end/tests/call_creds.cc
  18. 6
      test/core/end2end/tests/disappearing_server.cc
  19. 8
      test/core/end2end/tests/filter_context.cc
  20. 12
      test/core/end2end/tests/resource_quota_server.cc
  21. 4
      test/core/end2end/tests/server_streaming.cc
  22. 8
      test/core/end2end/tests/simple_delayed_request.cc
  23. 4
      test/core/end2end/tests/simple_request.cc
  24. 3
      test/core/end2end/tests/timeout_before_request_call.cc

@ -28,6 +28,7 @@ grpc_cc_library(
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/log:check",
"absl/log:log",
"absl/strings",
"absl/strings:str_format",
"absl/types:variant",
@ -64,6 +65,7 @@ grpc_cc_library(
hdrs = ["fixtures/http_proxy_fixture.h"],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -96,7 +98,10 @@ grpc_cc_library(
name = "proxy",
srcs = ["fixtures/proxy.cc"],
hdrs = ["fixtures/proxy.h"],
external_deps = ["absl/log:check"],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "C++",
deps = [
"//:channel_arg_names",
@ -120,6 +125,7 @@ grpc_cc_library(
external_deps = [
"absl/functional:any_invocable",
"absl/log:check",
"absl/log:log",
"absl/memory",
"absl/meta:type_traits",
"absl/random",
@ -500,7 +506,10 @@ grpc_core_end2end_test(name = "write_buffering_at_end")
grpc_cc_test(
name = "bad_server_response_test",
srcs = ["bad_server_response_test.cc"],
external_deps = ["absl/log:check"],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "C++",
deps = [
"cq_verifier",
@ -523,7 +532,10 @@ grpc_cc_test(
grpc_cc_test(
name = "connection_refused_test",
srcs = ["connection_refused_test.cc"],
external_deps = ["absl/log:check"],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "C++",
deps = [
"cq_verifier",
@ -541,6 +553,7 @@ grpc_cc_test(
srcs = ["dualstack_socket_test.cc"],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/status:statusor",
"absl/strings",
"absl/strings:str_format",
@ -565,6 +578,7 @@ grpc_cc_test(
srcs = ["goaway_server_test.cc"],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -596,7 +610,10 @@ grpc_cc_test(
grpc_cc_test(
name = "invalid_call_argument_test",
srcs = ["invalid_call_argument_test.cc"],
external_deps = ["absl/log:check"],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "C++",
deps = [
"cq_verifier",
@ -623,6 +640,7 @@ grpc_cc_test(
srcs = ["no_server_test.cc"],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/status",
"absl/status:statusor",
"absl/time",
@ -652,6 +670,7 @@ grpc_cc_test(
external_deps = [
"absl/functional:any_invocable",
"absl/log:check",
"absl/log:log",
"absl/memory",
"absl/meta:type_traits",
"absl/strings",

@ -25,6 +25,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/credentials.h>
#include <grpc/grpc.h>
@ -35,7 +36,6 @@
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@ -135,8 +135,7 @@ static void handle_write() {
static void handle_read(void* /*arg*/, grpc_error_handle error) {
if (!error.ok()) {
gpr_log(GPR_ERROR, "handle_read error: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "handle_read error: " << grpc_core::StatusToString(error);
return;
}
state.incoming_data_length += state.temp_incoming_buffer.length;
@ -145,15 +144,13 @@ static void handle_read(void* /*arg*/, grpc_error_handle error) {
for (i = 0; i < state.temp_incoming_buffer.count; i++) {
char* dump = grpc_dump_slice(state.temp_incoming_buffer.slices[i],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Server received: %s", dump);
VLOG(2) << "Server received: " << dump;
gpr_free(dump);
}
gpr_log(GPR_DEBUG,
"got %" PRIuPTR " bytes, expected %" PRIuPTR
" bytes or a non-HTTP2 response to be sent",
state.incoming_data_length,
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD);
VLOG(2) << "got " << state.incoming_data_length << " bytes, expected "
<< SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD
<< " bytes or a non-HTTP2 response to be sent";
if (state.incoming_data_length >=
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD ||
!state.http2_response) {
@ -299,8 +296,8 @@ static void actually_poll_server(void* arg) {
bool done = gpr_atm_acq_load(&state.done_atm) != 0;
gpr_timespec time_left =
gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME));
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", done,
time_left.tv_sec, time_left.tv_nsec);
VLOG(2) << "done=" << done << ", time_left=" << time_left.tv_sec << "."
<< time_left.tv_nsec;
if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) {
break;
}

@ -21,6 +21,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/credentials.h>
#include <grpc/grpc.h>
@ -29,7 +30,6 @@
#include <grpc/impl/propagation_bits.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
@ -49,8 +49,8 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_status_code status;
grpc_slice details;
gpr_log(GPR_INFO, "TEST: wait_for_ready=%d use_service_config=%d",
wait_for_ready, use_service_config);
LOG(INFO) << "TEST: wait_for_ready=" << wait_for_ready
<< " use_service_config=" << use_service_config;
grpc_init();
@ -81,7 +81,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
// create a call, channel to a port which will refuse connection
int port = grpc_pick_unused_port_or_die();
std::string addr = grpc_core::JoinHostPort("127.0.0.1", port);
gpr_log(GPR_INFO, "server: %s", addr.c_str());
LOG(INFO) << "server: " << addr;
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
chan = grpc_channel_create(addr.c_str(), creds, args);
grpc_channel_credentials_release(creds);

@ -29,6 +29,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@ -41,7 +42,6 @@
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/compression/message_compress.h"
@ -126,9 +126,8 @@ int raw_byte_buffer_eq_slice(grpc_byte_buffer* rbb, grpc_slice b) {
0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
GRPC_SLICE_LENGTH(a));
if (!ok) {
gpr_log(GPR_ERROR,
"SLICE MISMATCH: left_length=%" PRIuPTR " right_length=%" PRIuPTR,
GRPC_SLICE_LENGTH(a), GRPC_SLICE_LENGTH(b));
LOG(ERROR) << "SLICE MISMATCH: left_length=" << GRPC_SLICE_LENGTH(a)
<< " right_length=" << GRPC_SLICE_LENGTH(b);
std::string out;
const char* a_str = reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(a));
const char* b_str = reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(b));
@ -151,7 +150,7 @@ int raw_byte_buffer_eq_slice(grpc_byte_buffer* rbb, grpc_slice b) {
absl::CEscape(absl::string_view(&b_str[i], 1)),
"\u001b[0m");
}
gpr_log(GPR_ERROR, "%s", out.c_str());
LOG(ERROR) << out;
}
}
grpc_slice_unref(a);
@ -365,8 +364,7 @@ void CqVerifier::Verify(Duration timeout, SourceLocation location) {
while (!expectations_.empty()) {
must_log = std::exchange(added_expectations_, false) || must_log;
if (log_verifications_ && must_log) {
gpr_log(GPR_ERROR, "Verify %s for %s", ToShortString().c_str(),
timeout.ToString().c_str());
LOG(ERROR) << "Verify " << ToShortString() << " for " << timeout;
}
must_log = false;
grpc_event ev = Step(deadline);
@ -423,8 +421,7 @@ bool CqVerifier::AllMaybes() const {
void CqVerifier::VerifyEmpty(Duration timeout, SourceLocation location) {
if (log_verifications_) {
gpr_log(GPR_ERROR, "Verify empty completion queue for %s",
timeout.ToString().c_str());
LOG(ERROR) << "Verify empty completion queue for " << timeout;
}
const gpr_timespec deadline =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), timeout.as_timespec());

@ -21,6 +21,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include <grpc/impl/propagation_bits.h>
@ -47,7 +48,6 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gprpp/host_port.h"
@ -78,7 +78,7 @@ static void log_resolved_addrs(const char* label, const char* hostname) {
return;
}
for (const auto& addr : *addresses_or) {
gpr_log(GPR_INFO, "%s: %s", label, grpc_sockaddr_to_uri(&addr)->c_str());
LOG(INFO) << label << ": " << grpc_sockaddr_to_uri(&addr)->c_str();
}
}
@ -152,9 +152,9 @@ void test_connect(const char* server_host, const char* client_host, int port,
client = grpc_channel_create(client_hostport.c_str(), creds, nullptr);
grpc_channel_credentials_release(creds);
gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)",
server_hostport.c_str(), client_hostport.c_str(),
expect_ok ? "success" : "failure");
LOG(INFO) << "Testing with server=" << server_hostport.c_str()
<< " client=" << client_hostport.c_str() << " (expecting "
<< (expect_ok ? "success" : "failure") << ")";
log_resolved_addrs("server resolved addr", server_host);
log_resolved_addrs("client resolved addr", client_host);
@ -236,7 +236,7 @@ void test_connect(const char* server_host, const char* client_host, int port,
cqv.Verify();
peer = grpc_call_get_peer(c);
gpr_log(GPR_DEBUG, "got peer: '%s'", peer);
VLOG(2) << "got peer: '" << peer << "'";
gpr_free(peer);
CHECK_EQ(status, GRPC_STATUS_UNIMPLEMENTED);
@ -251,8 +251,8 @@ void test_connect(const char* server_host, const char* client_host, int port,
cqv.Expect(grpc_core::CqVerifier::tag(1), true);
cqv.Verify();
gpr_log(GPR_INFO, "status: %d (expected: %d)", status,
GRPC_STATUS_UNAVAILABLE);
LOG(INFO) << "status: " << status
<< " (expected: " << GRPC_STATUS_UNAVAILABLE << ")";
CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE);
}
@ -301,10 +301,9 @@ int external_dns_works(const char* host) {
// dualstack_socket_test from functioning correctly). See b/201064791.
if (grpc_sockaddr_to_uri(&addr).value() ==
"ipv6:%5B64:ff9b::7f00:1%5D:80") {
gpr_log(
GPR_INFO,
"Detected DNS64 server response. Tests that depend on "
"*.unittest.grpc.io. will be skipped as they won't work with DNS64.");
LOG(INFO) << "Detected DNS64 server response. Tests that depend on "
"*.unittest.grpc.io. will be skipped as they won't work "
"with DNS64.";
result = 0;
break;
}
@ -319,7 +318,7 @@ int main(int argc, char** argv) {
grpc_init();
if (!grpc_ipv6_loopback_available()) {
gpr_log(GPR_INFO, "Can't bind to ::1. Skipping IPv6 tests.");
LOG(INFO) << "Can't bind to ::1. Skipping IPv6 tests.";
do_ipv6 = 0;
}
@ -360,7 +359,7 @@ int main(int argc, char** argv) {
if (!external_dns_works("loopback4.unittest.grpc.io") ||
!external_dns_works("loopback46.unittest.grpc.io")) {
gpr_log(GPR_INFO, "Skipping tests that depend on *.unittest.grpc.io.");
LOG(INFO) << "Skipping tests that depend on *.unittest.grpc.io.";
} else {
test_connect("loopback46.unittest.grpc.io", "loopback4.unittest.grpc.io",
0, 1);

@ -23,6 +23,7 @@
#include <tuple>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/random/random.h"
@ -117,7 +118,7 @@ void CoreEnd2endTest::TearDown() {
// This will wait until gRPC shutdown has actually happened to make sure
// no gRPC resources (such as thread) are active. (timeout = 10s)
if (!grpc_wait_until_shutdown(10)) {
gpr_log(GPR_ERROR, "Timeout in waiting for gRPC shutdown");
LOG(ERROR) << "Timeout in waiting for gRPC shutdown";
}
}
CHECK_EQ(client_, nullptr);
@ -153,8 +154,8 @@ std::string CoreEnd2endTest::IncomingMessage::payload() const {
grpc_slice_buffer decompressed_buffer;
grpc_slice_buffer_init(&decompressed_buffer);
CHECK(grpc_msg_decompress(payload_->data.raw.compression,
&payload_->data.raw.slice_buffer,
&decompressed_buffer));
&payload_->data.raw.slice_buffer,
&decompressed_buffer));
grpc_byte_buffer* rbb = grpc_raw_byte_buffer_create(
decompressed_buffer.slices, decompressed_buffer.count);
grpc_byte_buffer_reader reader;

@ -27,6 +27,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/escaping.h"
@ -37,7 +38,6 @@
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
@ -510,8 +510,8 @@ static bool proxy_auth_header_matches(absl::string_view proxy_auth_header_val,
// which will cause the client connection to be dropped.
static void on_read_request_done_locked(void* arg, grpc_error_handle error) {
proxy_connection* conn = static_cast<proxy_connection*>(arg);
gpr_log(GPR_DEBUG, "on_read_request_done: %p %s", conn,
grpc_core::StatusToString(error).c_str());
VLOG(2) << "on_read_request_done: " << conn << " "
<< grpc_core::StatusToString(error);
if (!error.ok()) {
proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
error);
@ -670,7 +670,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
// Construct proxy address.
const int proxy_port = grpc_pick_unused_port_or_die();
proxy->proxy_name = grpc_core::JoinHostPort("localhost", proxy_port);
gpr_log(GPR_INFO, "Proxy address: %s", proxy->proxy_name.c_str());
LOG(INFO) << "Proxy address: " << proxy->proxy_name;
// Create TCP server.
auto channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/byte_buffer.h>
#include <grpc/impl/channel_arg_names.h>
@ -31,7 +32,6 @@
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@ -106,8 +106,8 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(
proxy->proxy_port = grpc_core::JoinHostPort("localhost", proxy_port);
proxy->server_port = grpc_core::JoinHostPort("localhost", server_port);
gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port.c_str(),
proxy->server_port.c_str());
VLOG(2) << "PROXY ADDR:" << proxy->proxy_port
<< " BACKEND:" << proxy->server_port;
proxy->cq = grpc_completion_queue_create_for_next(nullptr);
proxy->server = def->create_server(proxy->proxy_port.c_str(), server_args);

@ -36,6 +36,7 @@ grpc_cc_library(
hdrs = ["fuzzing_common.h"],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/strings",
],
deps = [
@ -92,6 +93,7 @@ grpc_cc_library(
name = "network_input",
srcs = ["network_input.cc"],
hdrs = ["network_input.h"],
external_deps = ["absl/log:log"],
deps = [
"fuzzer_input_proto",
"//:chttp2_frame",

@ -24,6 +24,7 @@
#include <new>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/types/optional.h"
@ -638,7 +639,7 @@ bool BasicFuzzer::Continue() {
BasicFuzzer::Result BasicFuzzer::ExecuteAction(
const api_fuzzer::Action& action) {
gpr_log(GPR_DEBUG, "EXECUTE_ACTION: %s", action.DebugString().c_str());
VLOG(2) << "EXECUTE_ACTION: " << action.DebugString();
switch (action.type_case()) {
case api_fuzzer::Action::TYPE_NOT_SET:
return BasicFuzzer::Result::kFailed;

@ -23,6 +23,7 @@
#include <utility>
#include <vector>
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
@ -520,8 +521,7 @@ Duration ScheduleConnection(
endpoint) mutable {
ExecCtx exec_ctx;
if (!endpoint.ok()) {
gpr_log(GPR_ERROR, "Failed to connect: %s",
endpoint.status().ToString().c_str());
LOG(ERROR) << "Failed to connect: " << endpoint.status();
return;
}
std::shared_ptr<EventEngine::Endpoint> ep =

@ -27,6 +27,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -40,7 +41,6 @@
#include <grpc/impl/propagation_bits.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@ -212,9 +212,8 @@ static void my_cancel_ares_request(grpc_ares_request* request) {
int main(int argc, char** argv) {
// TODO(yijiem): rewrite this test with a custom EventEngine DNS Resolver
if (grpc_core::IsEventEngineDnsEnabled()) {
gpr_log(
GPR_ERROR,
"Skipping iomgr-specific DNS test because EventEngine DNS is enabled");
LOG(ERROR) << "Skipping iomgr-specific DNS test because EventEngine DNS is "
"enabled";
return 0;
}
grpc_completion_queue* cq;

@ -43,6 +43,9 @@ def grpc_core_end2end_test(name, shard_count = 10, tags = []):
srcs = [
"tests/%s.cc" % name,
],
external_deps = [
"absl/log:log",
],
deps = [
"cq_verifier",
"end2end_test_lib",

@ -25,6 +25,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/types/optional.h"
#include "gtest/gtest.h"
@ -37,7 +38,6 @@
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
@ -245,9 +245,7 @@ static void simple_request_body(grpc_core::CoreTestFixture* f,
class H2SslCertTest : public ::testing::TestWithParam<CoreTestConfigWrapper> {
protected:
H2SslCertTest() {
gpr_log(GPR_INFO, "SSL_CERT_tests/%s", GetParam().config.name);
}
H2SslCertTest() { LOG(INFO) << "SSL_CERT_tests/" << GetParam().config.name; }
void SetUp() override {
fixture_ = GetParam().config.create_fixture(grpc_core::ChannelArgs(),
grpc_core::ChannelArgs());

@ -24,6 +24,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/byte_buffer.h>
#include <grpc/credentials.h>
@ -32,7 +33,6 @@
#include <grpc/impl/propagation_bits.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
@ -155,7 +155,7 @@ static void cleanup_test() {
}
static void test_non_null_reserved_on_start_batch() {
gpr_log(GPR_INFO, "test_non_null_reserved_on_start_batch");
LOG(INFO) << "test_non_null_reserved_on_start_batch";
prepare_test(1);
CHECK(GRPC_CALL_ERROR ==
@ -165,7 +165,7 @@ static void test_non_null_reserved_on_start_batch() {
}
static void test_non_null_reserved_on_op() {
gpr_log(GPR_INFO, "test_non_null_reserved_on_op");
LOG(INFO) << "test_non_null_reserved_on_op";
grpc_op* op;
prepare_test(1);
@ -184,7 +184,7 @@ static void test_non_null_reserved_on_op() {
}
static void test_send_initial_metadata_more_than_once() {
gpr_log(GPR_INFO, "test_send_initial_metadata_more_than_once");
LOG(INFO) << "test_send_initial_metadata_more_than_once";
grpc_op* op;
prepare_test(1);
@ -216,7 +216,7 @@ static void test_send_initial_metadata_more_than_once() {
}
static void test_too_many_metadata() {
gpr_log(GPR_INFO, "test_too_many_metadata");
LOG(INFO) << "test_too_many_metadata";
grpc_op* op;
prepare_test(1);
@ -235,7 +235,7 @@ static void test_too_many_metadata() {
}
static void test_send_null_message() {
gpr_log(GPR_INFO, "test_send_null_message");
LOG(INFO) << "test_send_null_message";
grpc_op* op;
prepare_test(1);
@ -259,7 +259,7 @@ static void test_send_null_message() {
}
static void test_send_messages_at_the_same_time() {
gpr_log(GPR_INFO, "test_send_messages_at_the_same_time");
LOG(INFO) << "test_send_messages_at_the_same_time";
grpc_op* op;
grpc_slice request_payload_slice =
@ -293,7 +293,7 @@ static void test_send_messages_at_the_same_time() {
}
static void test_send_server_status_from_client() {
gpr_log(GPR_INFO, "test_send_server_status_from_client");
LOG(INFO) << "test_send_server_status_from_client";
grpc_op* op;
prepare_test(1);
@ -315,7 +315,7 @@ static void test_send_server_status_from_client() {
}
static void test_receive_initial_metadata_twice_at_client() {
gpr_log(GPR_INFO, "test_receive_initial_metadata_twice_at_client");
LOG(INFO) << "test_receive_initial_metadata_twice_at_client";
grpc_op* op;
prepare_test(1);
@ -347,7 +347,7 @@ static void test_receive_initial_metadata_twice_at_client() {
}
static void test_receive_message_with_invalid_flags() {
gpr_log(GPR_INFO, "test_receive_message_with_invalid_flags");
LOG(INFO) << "test_receive_message_with_invalid_flags";
grpc_op* op;
grpc_byte_buffer* payload = nullptr;
@ -366,7 +366,7 @@ static void test_receive_message_with_invalid_flags() {
}
static void test_receive_two_messages_at_the_same_time() {
gpr_log(GPR_INFO, "test_receive_two_messages_at_the_same_time");
LOG(INFO) << "test_receive_two_messages_at_the_same_time";
grpc_op* op;
grpc_byte_buffer* payload = nullptr;
@ -390,7 +390,7 @@ static void test_receive_two_messages_at_the_same_time() {
}
static void test_recv_close_on_server_from_client() {
gpr_log(GPR_INFO, "test_recv_close_on_server_from_client");
LOG(INFO) << "test_recv_close_on_server_from_client";
grpc_op* op;
prepare_test(1);
@ -409,7 +409,7 @@ static void test_recv_close_on_server_from_client() {
}
static void test_recv_status_on_client_twice() {
gpr_log(GPR_INFO, "test_recv_status_on_client_twice");
LOG(INFO) << "test_recv_status_on_client_twice";
grpc_op* op;
prepare_test(1);
@ -446,7 +446,7 @@ static void test_recv_status_on_client_twice() {
}
static void test_send_close_from_client_on_server() {
gpr_log(GPR_INFO, "test_send_close_from_client_on_server");
LOG(INFO) << "test_send_close_from_client_on_server";
grpc_op* op;
prepare_test(0);
@ -464,7 +464,7 @@ static void test_send_close_from_client_on_server() {
}
static void test_recv_status_on_client_from_server() {
gpr_log(GPR_INFO, "test_recv_status_on_client_from_server");
LOG(INFO) << "test_recv_status_on_client_from_server";
grpc_op* op;
prepare_test(0);
@ -486,7 +486,7 @@ static void test_recv_status_on_client_from_server() {
}
static void test_send_status_from_server_with_invalid_flags() {
gpr_log(GPR_INFO, "test_send_status_from_server_with_invalid_flags");
LOG(INFO) << "test_send_status_from_server_with_invalid_flags";
grpc_op* op;
prepare_test(0);
@ -508,7 +508,7 @@ static void test_send_status_from_server_with_invalid_flags() {
}
static void test_too_many_trailing_metadata() {
gpr_log(GPR_INFO, "test_too_many_trailing_metadata");
LOG(INFO) << "test_too_many_trailing_metadata";
grpc_op* op;
prepare_test(0);
@ -531,7 +531,7 @@ static void test_too_many_trailing_metadata() {
}
static void test_send_server_status_twice() {
gpr_log(GPR_INFO, "test_send_server_status_twice");
LOG(INFO) << "test_send_server_status_twice";
grpc_op* op;
prepare_test(0);
@ -560,7 +560,7 @@ static void test_send_server_status_twice() {
}
static void test_recv_close_on_server_with_invalid_flags() {
gpr_log(GPR_INFO, "test_recv_close_on_server_with_invalid_flags");
LOG(INFO) << "test_recv_close_on_server_with_invalid_flags";
grpc_op* op;
prepare_test(0);
@ -579,7 +579,7 @@ static void test_recv_close_on_server_with_invalid_flags() {
}
static void test_recv_close_on_server_twice() {
gpr_log(GPR_INFO, "test_recv_close_on_server_twice");
LOG(INFO) << "test_recv_close_on_server_twice";
grpc_op* op;
prepare_test(0);
@ -603,7 +603,7 @@ static void test_recv_close_on_server_twice() {
}
static void test_invalid_initial_metadata_reserved_key() {
gpr_log(GPR_INFO, "test_invalid_initial_metadata_reserved_key");
LOG(INFO) << "test_invalid_initial_metadata_reserved_key";
grpc_metadata metadata;
metadata.key = grpc_slice_from_static_string(":start_with_colon");
@ -626,7 +626,7 @@ static void test_invalid_initial_metadata_reserved_key() {
}
static void test_multiple_ops_in_a_single_batch() {
gpr_log(GPR_INFO, "test_multiple_ops_in_a_single_batch");
LOG(INFO) << "test_multiple_ops_in_a_single_batch";
grpc_op* op;
prepare_test(1);

@ -21,6 +21,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/time/time.h"
@ -31,7 +32,6 @@
#include <grpc/impl/propagation_bits.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
@ -45,7 +45,7 @@
#include "test/core/test_util/test_config.h"
void run_test(bool wait_for_ready) {
gpr_log(GPR_INFO, "TEST: wait_for_ready=%d", wait_for_ready);
LOG(INFO) << "TEST: wait_for_ready=" << wait_for_ready;
grpc_init();
@ -104,7 +104,7 @@ void run_test(bool wait_for_ready) {
cqv.Expect(grpc_core::CqVerifier::tag(1), true);
cqv.Verify();
gpr_log(GPR_INFO, "call status: %d", status);
LOG(INFO) << "call status: " << status;
if (wait_for_ready) {
CHECK_EQ(status, GRPC_STATUS_DEADLINE_EXCEEDED);
} else {

@ -18,6 +18,7 @@
#include <memory>
#include "absl/log/log.h"
#include "absl/types/optional.h"
#include "gtest/gtest.h"
@ -25,7 +26,6 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/time.h"
@ -47,17 +47,17 @@ const char overridden_fake_md_value[] = "overridden_fake_value";
void PrintAuthContext(bool is_client, const grpc_auth_context* ctx) {
const grpc_auth_property* p;
grpc_auth_property_iterator it;
gpr_log(GPR_INFO, "%s peer:", is_client ? "client" : "server");
gpr_log(GPR_INFO, "\tauthenticated: %s",
grpc_auth_context_peer_is_authenticated(ctx) ? "YES" : "NO");
LOG(INFO) << (is_client ? "client" : "server") << " peer:";
LOG(INFO) << "\tauthenticated: "
<< (grpc_auth_context_peer_is_authenticated(ctx) ? "YES" : "NO");
it = grpc_auth_context_peer_identity(ctx);
while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) {
gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value);
LOG(INFO) << "\t\t" << p->name << ": " << p->value;
}
gpr_log(GPR_INFO, "\tall properties:");
LOG(INFO) << "\tall properties:";
it = grpc_auth_context_property_iterator(ctx);
while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) {
gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value);
LOG(INFO) << "\t\t" << p->name << ": " << p->value;
}
}

@ -18,10 +18,10 @@
#include <memory>
#include "absl/log/log.h"
#include "gtest/gtest.h"
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/time.h"
@ -31,13 +31,13 @@
namespace grpc_core {
static void OneRequestAndShutdownServer(CoreEnd2endTest& test) {
gpr_log(GPR_ERROR, "Create client side call");
LOG(ERROR) << "Create client side call";
auto c = test.NewClientCall("/service/method")
.Timeout(Duration::Seconds(30))
.Create();
CoreEnd2endTest::IncomingMetadata server_initial_md;
CoreEnd2endTest::IncomingStatusOnClient server_status;
gpr_log(GPR_ERROR, "Start initial batch");
LOG(ERROR) << "Start initial batch";
c.NewBatch(1)
.SendInitialMetadata({})
.SendCloseFromClient()

@ -20,11 +20,11 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "gtest/gtest.h"
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
@ -53,7 +53,7 @@ grpc_error_handle init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = static_cast<call_data*>(elem->call_data);
calld->context = args->context;
gpr_log(GPR_INFO, "init_call_elem(): context=%p", args->context);
LOG(INFO) << "init_call_elem(): context=" << args->context;
return absl::OkStatus();
}
@ -63,8 +63,8 @@ void start_transport_stream_op_batch(grpc_call_element* elem,
// If batch payload context is not null (which will happen in some
// cancellation cases), make sure we get the same context here that we
// saw in init_call_elem().
gpr_log(GPR_INFO, "start_transport_stream_op_batch(): context=%p",
batch->payload->context);
LOG(INFO) << "start_transport_stream_op_batch(): context="
<< batch->payload->context;
if (batch->payload->context != nullptr) {
CHECK(calld->context == batch->payload->context);
}

@ -21,13 +21,13 @@
#include <algorithm>
#include <vector>
#include "absl/log/log.h"
#include "absl/strings/str_format.h"
#include "gtest/gtest.h"
#include <grpc/grpc.h>
#include <grpc/impl/channel_arg_names.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/experiments/experiments.h"
@ -146,11 +146,11 @@ CORE_END2END_TEST(ResourceQuotaTest, ResourceQuota) {
cancelled_calls_on_server++;
}
}
gpr_log(GPR_INFO,
"Done. %d total calls: %d cancelled at server, %d cancelled at "
"client, %d timed out, %d unavailable.",
kNumCalls, cancelled_calls_on_server, cancelled_calls_on_client,
deadline_exceeded, unavailable);
LOG(INFO) << "Done. " << kNumCalls
<< " total calls: " << cancelled_calls_on_server
<< " cancelled at server, " << cancelled_calls_on_client
<< " cancelled at client, " << deadline_exceeded << " timed out, "
<< unavailable << " unavailable.";
ShutdownServerAndNotify(0);
Expect(0, PerformAction{[this](bool success) {

@ -19,10 +19,10 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "gtest/gtest.h"
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/time.h"
#include "test/core/end2end/cq_verifier.h"
@ -70,7 +70,7 @@ void ServerStreaming(CoreEnd2endTest& test, int num_messages) {
test.Expect(104, true);
test.Step();
gpr_log(GPR_DEBUG, "SEEN_STATUS:%d", seen_status);
VLOG(2) << "SEEN_STATUS:" << seen_status;
// Client keeps reading messages till it gets the status
int num_messages_received = 0;

@ -18,12 +18,12 @@
#include <memory>
#include "absl/log/log.h"
#include "gtest/gtest.h"
#include <grpc/grpc.h>
#include <grpc/impl/channel_arg_names.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/time.h"
@ -37,17 +37,17 @@ CORE_END2END_TEST(Http2SingleHopTest, SimpleDelayedRequestShort) {
.Set(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, 1000)
.Set(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 1000)
.Set(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, 5000));
gpr_log(GPR_ERROR, "Create client side call");
LOG(ERROR) << "Create client side call";
auto c = NewClientCall("/foo").Timeout(Duration::Minutes(1)).Create();
IncomingMetadata server_initial_metadata;
IncomingStatusOnClient server_status;
gpr_log(GPR_ERROR, "Start initial batch");
LOG(ERROR) << "Start initial batch";
c.NewBatch(1)
.SendInitialMetadata({}, GRPC_INITIAL_METADATA_WAIT_FOR_READY)
.SendCloseFromClient()
.RecvInitialMetadata(server_initial_metadata)
.RecvStatusOnClient(server_status);
gpr_log(GPR_ERROR, "Start server");
LOG(ERROR) << "Start server";
InitServer(ChannelArgs());
auto s = RequestCall(101);
Expect(101, true);

@ -22,13 +22,13 @@
#include <memory>
#include <string>
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/stats_data.h"
@ -91,7 +91,7 @@ void SimpleRequestBody(CoreEnd2endTest& test) {
expected_calls *= 2;
}
auto after = global_stats().Collect();
gpr_log(GPR_DEBUG, "%s", StatsAsJson(after.get()).c_str());
VLOG(2) << StatsAsJson(after.get());
EXPECT_EQ(after->client_calls_created - before->client_calls_created,
expected_calls);
EXPECT_EQ(after->server_calls_created - before->server_calls_created,

@ -16,6 +16,7 @@
#include <memory>
#include "absl/log/log.h"
#include "gtest/gtest.h"
#include <grpc/grpc.h>
@ -147,7 +148,7 @@ CORE_END2END_TEST(CoreDeadlineSingleHopTest,
bool got_call = false;
std::unique_ptr<IncomingCloseOnServer> client_close;
Expect(2, MaybePerformAction{[this, &s, &got_call, &client_close](bool ok) {
gpr_log(GPR_INFO, "\n***\n*** got call: %d\n***", ok);
LOG(INFO) << "\n***\n*** got call: " << ok << "\n***";
got_call = true;
if (ok) {
// If we successfully get a call, then we should additionally get a

Loading…
Cancel
Save