From ba2d320d41adfc2676cb71e502e682bcb04cb25c Mon Sep 17 00:00:00 2001 From: tanvi-jagtap Date: Tue, 11 Jun 2024 04:50:15 +0000 Subject: [PATCH] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log --- .../address_utils/parse_address_with_named_scope_id_test.cc | 4 ++-- test/core/client_channel/client_channel_test.cc | 3 ++- test/core/end2end/fixtures/http_proxy_fixture.cc | 2 +- test/core/iomgr/fd_posix_test.cc | 2 +- test/core/slice/slice_test.cc | 3 +-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/core/address_utils/parse_address_with_named_scope_id_test.cc b/test/core/address_utils/parse_address_with_named_scope_id_test.cc index eb76adef43d..19b21f35027 100644 --- a/test/core/address_utils/parse_address_with_named_scope_id_test.cc +++ b/test/core/address_utils/parse_address_with_named_scope_id_test.cc @@ -51,7 +51,7 @@ static void test_grpc_parse_ipv6_parity_with_getaddrinfo( grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(target); if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status(); ASSERT_TRUE(uri.ok()); } grpc_resolved_address addr; @@ -75,7 +75,7 @@ static void test_grpc_parse_ipv6_parity_with_getaddrinfo( struct sockaddr_in6 resolve_with_gettaddrinfo(const char* uri_text) { absl::StatusOr uri = grpc_core::URI::Parse(uri_text); if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status(); EXPECT_TRUE(uri.ok()); } std::string host; diff --git a/test/core/client_channel/client_channel_test.cc b/test/core/client_channel/client_channel_test.cc index 1aa8c644816..594ca1f6864 100644 --- a/test/core/client_channel/client_channel_test.cc +++ b/test/core/client_channel/client_channel_test.cc @@ -17,6 +17,7 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/string_view.h" #include "gtest/gtest.h" @@ -106,7 +107,7 @@ class ClientChannelTest : public YodelTest { RefCountedPtr CreateSubchannel( const grpc_resolved_address& address, const ChannelArgs& args) override { - gpr_log(GPR_INFO, "CreateSubchannel: args=%s", args.ToString().c_str()); + LOG(INFO) << "CreateSubchannel: args=" << args.ToString(); return Subchannel::Create(MakeOrphanable(), address, args); } }; diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc index 4875b2591b3..f0ffe5519a5 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.cc +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc @@ -208,7 +208,7 @@ static void on_read_request_done_locked(void* arg, grpc_error_handle error); static void proxy_connection_failed(proxy_connection* conn, failure_type failure, const char* prefix, grpc_error_handle error) { - gpr_log(GPR_INFO, "%s: %s", prefix, grpc_core::StatusToString(error).c_str()); + LOG(INFO) << prefix << ": " << grpc_core::StatusToString(error); // Decide whether we should shut down the client and server. bool shutdown_client = false; bool shutdown_server = false; diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index 8497b62591a..0cb032f099a 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -348,7 +348,7 @@ static void client_start(client* cl, int port) { pfd.events = POLLOUT; pfd.revents = 0; if (poll(&pfd, 1, -1) == -1) { - gpr_log(GPR_ERROR, "poll() failed during connect; errno=%d", errno); + LOG(ERROR) << "poll() failed during connect; errno=" << errno; abort(); } } else { diff --git a/test/core/slice/slice_test.cc b/test/core/slice/slice_test.cc index 44c139d8c07..24b5716dbea 100644 --- a/test/core/slice/slice_test.cc +++ b/test/core/slice/slice_test.cc @@ -33,7 +33,6 @@ #include "gtest/gtest.h" #include -#include #include #include "src/core/lib/gprpp/memory.h" @@ -402,7 +401,7 @@ TEST(SliceTest, ExternalAsOwned) { // In ASAN (where we can be sure that it'll crash), go ahead and read the // bytes we just deleted. if (BuiltUnderAsan()) { - ASSERT_DEATH({ gpr_log(GPR_DEBUG, "%" PRIdPTR, SumSlice(slice)); }, ""); + ASSERT_DEATH({ VLOG(2) << SumSlice(slice); }, ""); } EXPECT_EQ(initial_sum, SumSlice(owned)); }