diff --git a/BUILD b/BUILD index 68633e852c0..f83a6bdc989 100644 --- a/BUILD +++ b/BUILD @@ -583,6 +583,7 @@ grpc_cc_library( defines = ["GRPC_NO_XDS"], external_deps = [ "absl/base:core_headers", + "absl/log:log", ], language = "c++", public_hdrs = GRPC_PUBLIC_HDRS, @@ -654,6 +655,7 @@ grpc_cc_library( }), external_deps = [ "absl/base:core_headers", + "absl/log:log", ], language = "c++", public_hdrs = GRPC_PUBLIC_HDRS, @@ -787,9 +789,9 @@ grpc_cc_library( "absl/base:core_headers", "absl/base:log_severity", "absl/functional:any_invocable", - "absl/log", "absl/log:check", "absl/log:globals", + "absl/log:log", "absl/memory", "absl/random", "absl/status", @@ -906,6 +908,7 @@ grpc_cc_library( hdrs = GRPCXX_PUBLIC_HDRS, external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings:cord", "absl/synchronization", "protobuf_headers", @@ -936,6 +939,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings:cord", ], language = "c++", @@ -1005,6 +1009,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -1064,6 +1069,7 @@ grpc_cc_library( ], external_deps = [ "absl/container:flat_hash_set", + "absl/log:log", "absl/strings", "absl/types:optional", "absl/types:span", @@ -1250,6 +1256,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", "absl/synchronization", ], @@ -1382,6 +1389,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/types:optional", @@ -1441,6 +1449,7 @@ grpc_cc_library( external_deps = [ "absl/container:inlined_vector", "absl/log:check", + "absl/log:log", ], language = "c++", deps = [ @@ -1492,6 +1501,9 @@ grpc_cc_library( hdrs = [ "//src/core:lib/surface/api_trace.h", ], + external_deps = [ + "absl/log:log", + ], language = "c++", deps = [ "gpr", @@ -1810,6 +1822,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/types:optional", @@ -1899,6 +1912,7 @@ grpc_cc_library( "absl/container:flat_hash_set", "absl/hash", "absl/log:check", + "absl/log:log", "absl/random", "absl/status", "absl/status:statusor", @@ -2292,6 +2306,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:inlined_vector", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2399,6 +2414,7 @@ grpc_cc_library( "//src/core:tsi/alts/handshaker/transport_security_common_api.h", ], external_deps = [ + "absl/log:log", "@com_google_protobuf//upb:base", "@com_google_protobuf//upb:mem", ], @@ -2457,6 +2473,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2541,6 +2558,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2974,6 +2992,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:inlined_vector", "absl/log:check", + "absl/log:log", ], language = "c++", visibility = ["@grpc:client_channel"], @@ -2994,7 +3013,10 @@ grpc_cc_library( name = "grpc_trace", srcs = ["//src/core:lib/debug/trace.cc"], hdrs = ["//src/core:lib/debug/trace.h"], - external_deps = ["absl/strings"], + external_deps = [ + "absl/log:log", + "absl/strings", + ], language = "c++", visibility = ["@grpc:trace"], deps = [ @@ -3139,6 +3161,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:inlined_vector", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings:str_format", ], @@ -3175,6 +3198,7 @@ grpc_cc_library( ], external_deps = [ "absl/base:core_headers", + "absl/log:log", "absl/status", "absl/strings", "absl/types:optional", @@ -3221,6 +3245,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings:str_format", ], visibility = [ @@ -3252,6 +3277,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3286,6 +3312,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", "absl/strings:str_format", ], @@ -3314,6 +3341,9 @@ grpc_cc_library( hdrs = [ "//src/core:lib/iomgr/internal_errqueue.h", ], + external_deps = [ + "absl/log:log", + ], tags = ["nofixdeps"], visibility = ["@grpc:iomgr_internal_errqueue"], deps = [ @@ -3332,6 +3362,7 @@ grpc_cc_library( "//src/core:lib/iomgr/buffer_list.h", ], external_deps = [ + "absl/log:log", "absl/strings", "absl/strings:str_format", "absl/types:optional", @@ -3378,6 +3409,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3545,6 +3577,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3578,6 +3611,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", "@com_google_protobuf//upb:base", @@ -3620,6 +3654,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", ], @@ -3811,6 +3846,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3875,6 +3911,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:bind_front", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3929,6 +3966,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", "absl/types:optional", @@ -3973,6 +4011,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", ], language = "c++", visibility = [ @@ -4061,7 +4100,10 @@ grpc_cc_library( "//src/core:lib/security/security_connector/load_system_roots_supported.h", "//src/core:lib/security/util/json_util.h", ], - external_deps = ["absl/strings"], + external_deps = [ + "absl/log:log", + "absl/strings", + ], language = "c++", visibility = ["@grpc:public"], deps = [ @@ -4154,6 +4196,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/types:span", "libcrypto", "libssl", @@ -4185,6 +4228,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/memory", "libssl", ], @@ -4265,6 +4309,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4517,6 +4562,7 @@ grpc_cc_library( external_deps = [ "absl/functional:function_ref", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", ], @@ -4573,6 +4619,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/random:bit_gen_ref", "absl/status", "absl/strings", @@ -4615,6 +4662,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", ], deps = [ @@ -4855,6 +4903,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", "absl/types:span", ], diff --git a/CMakeLists.txt b/CMakeLists.txt index 30104c08dec..3499823786a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1052,6 +1052,7 @@ if(gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx dualstack_socket_test) endif() + add_dependencies(buildtests_cxx dump_args_test) add_dependencies(buildtests_cxx duplicate_header_bad_client_test) add_dependencies(buildtests_cxx empty_batch_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) @@ -12393,6 +12394,41 @@ endif() endif() if(gRPC_BUILD_TESTS) +add_executable(dump_args_test + src/core/lib/gprpp/dump_args.cc + test/core/gprpp/dump_args_test.cc +) +target_compile_features(dump_args_test PUBLIC cxx_std_14) +target_include_directories(dump_args_test + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + ${_gRPC_RE2_INCLUDE_DIR} + ${_gRPC_SSL_INCLUDE_DIR} + ${_gRPC_UPB_GENERATED_DIR} + ${_gRPC_UPB_GRPC_GENERATED_DIR} + ${_gRPC_UPB_INCLUDE_DIR} + ${_gRPC_XXHASH_INCLUDE_DIR} + ${_gRPC_ZLIB_INCLUDE_DIR} + third_party/googletest/googletest/include + third_party/googletest/googletest + third_party/googletest/googlemock/include + third_party/googletest/googlemock + ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(dump_args_test + ${_gRPC_ALLTARGETS_LIBRARIES} + gtest + absl::any_invocable + absl::check +) + + +endif() +if(gRPC_BUILD_TESTS) + add_executable(duplicate_header_bad_client_test test/core/bad_client/bad_client.cc test/core/bad_client/tests/duplicate_header.cc diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 2d88806b024..b60ae5b5e2a 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -8670,6 +8670,20 @@ targets: - linux - posix - mac +- name: dump_args_test + gtest: true + build: test + language: c++ + headers: + - src/core/lib/gprpp/dump_args.h + src: + - src/core/lib/gprpp/dump_args.cc + - test/core/gprpp/dump_args_test.cc + deps: + - gtest + - absl/functional:any_invocable + - absl/log:check + uses_polling: false - name: duplicate_header_bad_client_test gtest: true build: test diff --git a/src/core/BUILD b/src/core/BUILD index a2b68107fa2..a9580c2aaa6 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -48,6 +48,25 @@ grpc_cc_library( language = "c++", ) +grpc_cc_library( + name = "dump_args", + srcs = [ + "lib/gprpp/dump_args.cc", + ], + hdrs = [ + "lib/gprpp/dump_args.h", + ], + external_deps = [ + "absl/functional:any_invocable", + "absl/log:check", + "absl/strings", + ], + language = "c++", + deps = [ + "//:gpr_platform", + ], +) + grpc_cc_library( name = "slice_cast", hdrs = [ @@ -197,6 +216,7 @@ grpc_cc_library( external_deps = [ "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/strings", ], language = "c++", @@ -395,6 +415,7 @@ grpc_cc_library( "lib/gprpp/validation_errors.h", ], external_deps = [ + "absl/log:log", "absl/status", "absl/strings", ], @@ -511,7 +532,10 @@ grpc_cc_library( grpc_cc_library( name = "map_pipe", - external_deps = ["absl/status"], + external_deps = [ + "absl/log:log", + "absl/status", + ], language = "c++", public_hdrs = [ "lib/promise/map_pipe.h", @@ -540,6 +564,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/strings", "absl/strings:str_format", ], @@ -987,6 +1012,7 @@ grpc_cc_library( name = "latch", external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", ], language = "c++", @@ -1005,6 +1031,7 @@ grpc_cc_library( name = "inter_activity_latch", external_deps = [ "absl/base:core_headers", + "absl/log:log", "absl/strings", ], language = "c++", @@ -1027,6 +1054,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", "absl/strings:str_format", "absl/types:optional", @@ -1050,6 +1078,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", "absl/types:optional", "absl/types:variant", @@ -1161,6 +1190,7 @@ grpc_cc_library( name = "for_each", external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", ], @@ -1183,6 +1213,7 @@ grpc_cc_library( name = "ref_counted", external_deps = [ "absl/log:check", + "absl/log:log", ], language = "c++", public_hdrs = ["lib/gprpp/ref_counted.h"], @@ -1199,6 +1230,7 @@ grpc_cc_library( name = "dual_ref_counted", external_deps = [ "absl/log:check", + "absl/log:log", ], language = "c++", public_hdrs = ["lib/gprpp/dual_ref_counted.h"], @@ -1394,6 +1426,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:flat_hash_set", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", "absl/types:optional", @@ -1444,6 +1477,9 @@ grpc_cc_library( hdrs = [ "lib/resource_quota/arena.h", ], + external_deps = [ + "absl/log:log", + ], visibility = [ "@grpc:alt_grpc_base_legacy", ], @@ -1543,6 +1579,9 @@ grpc_cc_library( hdrs = [ "lib/slice/slice_refcount.h", ], + external_deps = [ + "absl/log:log", + ], public_hdrs = [ "//:include/grpc/slice.h", ], @@ -1610,6 +1649,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/strings:str_format", ], @@ -1637,6 +1677,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings:str_format", ], visibility = ["@grpc:alt_grpc_base_legacy"], @@ -1658,6 +1699,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings:str_format", "absl/types:optional", ], @@ -1739,6 +1781,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", ], deps = [ "//:config_vars", @@ -1888,6 +1931,7 @@ grpc_cc_library( "absl/container:flat_hash_set", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/time", "absl/types:optional", ], @@ -1938,6 +1982,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/time", "absl/types:optional", ], @@ -2095,6 +2140,7 @@ grpc_cc_library( "absl/container:inlined_vector", "absl/functional:function_ref", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2201,6 +2247,7 @@ grpc_cc_library( ], external_deps = [ "absl/functional:any_invocable", + "absl/log:log", "absl/status", "absl/types:optional", ], @@ -2225,6 +2272,7 @@ grpc_cc_library( "absl/functional:any_invocable", "absl/hash", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2286,6 +2334,7 @@ grpc_cc_library( external_deps = [ "absl/cleanup", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2318,6 +2367,7 @@ grpc_cc_library( external_deps = [ "absl/cleanup", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2345,6 +2395,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2381,6 +2432,7 @@ grpc_cc_library( "absl/functional:any_invocable", "absl/hash", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2423,6 +2475,7 @@ grpc_cc_library( hdrs = ["lib/event_engine/windows/windows_engine.h"], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2477,6 +2530,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings:str_format", ], @@ -2506,6 +2560,7 @@ grpc_cc_library( "absl/cleanup", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings:str_format", ], @@ -2534,6 +2589,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings:str_format", @@ -2568,6 +2624,7 @@ grpc_cc_library( external_deps = [ "absl/container:flat_hash_map", "absl/log:check", + "absl/log:log", "absl/strings", "absl/strings:str_format", ], @@ -2602,6 +2659,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2628,6 +2686,9 @@ grpc_cc_library( hdrs = [ "lib/event_engine/trace.h", ], + external_deps = [ + "absl/log:log", + ], deps = [ "//:gpr", "//:gpr_platform", @@ -2818,6 +2879,7 @@ grpc_cc_library( "absl/functional:any_invocable", "absl/hash", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2874,6 +2936,7 @@ grpc_cc_library( hdrs = ["lib/transport/bdp_estimator.h"], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", ], deps = [ @@ -3059,6 +3122,7 @@ grpc_cc_library( external_deps = [ "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/strings", "absl/types:optional", ], @@ -3137,7 +3201,10 @@ grpc_cc_library( hdrs = [ "service_config/service_config_parser.h", ], - external_deps = ["absl/strings"], + external_deps = [ + "absl/log:log", + "absl/strings", + ], language = "c++", deps = [ "channel_args", @@ -3166,6 +3233,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/meta:type_traits", "absl/strings", "absl/strings:str_format", @@ -3341,6 +3409,7 @@ grpc_cc_library( "client_channel/retry_service_config.h", ], external_deps = [ + "absl/log:log", "absl/strings", "absl/types:optional", ], @@ -3391,6 +3460,7 @@ grpc_cc_library( "client_channel/backup_poller.h", ], external_deps = [ + "absl/log:log", "absl/status", ], language = "c++", @@ -3414,6 +3484,7 @@ grpc_cc_library( "service_config/service_config_channel_arg_filter.cc", ], external_deps = [ + "absl/log:log", "absl/status", "absl/status:statusor", "absl/types:optional", @@ -3500,6 +3571,7 @@ grpc_cc_library( hdrs = ["load_balancing/lb_policy_registry.h"], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3610,6 +3682,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3749,6 +3822,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/strings", ], deps = [ @@ -3796,6 +3870,7 @@ grpc_cc_library( "lib/security/authorization/grpc_server_authz_filter.h", ], external_deps = [ + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3838,6 +3913,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/container:flat_hash_map", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3871,6 +3947,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -3951,6 +4028,9 @@ grpc_cc_library( hdrs = [ "tsi/local_transport_security.h", ], + external_deps = [ + "absl/log:log", + ], language = "c++", deps = [ "//:event_engine_base_hdrs", @@ -3972,6 +4052,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4019,6 +4100,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", "absl/strings:str_format", @@ -4064,6 +4146,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/types:optional", @@ -4146,6 +4229,7 @@ grpc_cc_library( "absl/container:inlined_vector", "absl/functional:bind_front", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4232,6 +4316,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4294,6 +4379,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4340,6 +4426,7 @@ grpc_cc_library( "lib/http/httpcli_ssl_credentials.h", ], external_deps = [ + "absl/log:log", "absl/status", "absl/strings", "absl/types:optional", @@ -4414,6 +4501,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -4564,6 +4652,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/meta:type_traits", "absl/random", "absl/status", @@ -4645,6 +4734,7 @@ grpc_cc_library( "ext/filters/message_size/message_size_filter.h", ], external_deps = [ + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/strings:str_format", @@ -4693,6 +4783,7 @@ grpc_cc_library( ], external_deps = [ "absl/base:core_headers", + "absl/log:log", "absl/meta:type_traits", "absl/random", "absl/status", @@ -5085,6 +5176,7 @@ grpc_cc_library( "absl/cleanup", "absl/functional:bind_front", "absl/log:check", + "absl/log:log", "absl/memory", "absl/random", "absl/status", @@ -5269,6 +5361,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5347,6 +5440,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5407,6 +5501,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5457,6 +5552,7 @@ grpc_cc_library( "load_balancing/xds/xds_cluster_manager.cc", ], external_deps = [ + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5500,6 +5596,7 @@ grpc_cc_library( "load_balancing/xds/xds_wrr_locality.cc", ], external_deps = [ + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5569,6 +5666,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5616,6 +5714,7 @@ grpc_cc_library( external_deps = [ "absl/functional:function_ref", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/types:optional", @@ -5740,7 +5839,10 @@ grpc_cc_library( hdrs = [ "lib/transport/connectivity_state.h", ], - external_deps = ["absl/status"], + external_deps = [ + "absl/log:log", + "absl/status", + ], deps = [ "closure", "error", @@ -5775,6 +5877,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:inlined_vector", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -5825,6 +5928,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/meta:type_traits", "absl/random", "absl/status", @@ -5999,6 +6103,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6047,6 +6152,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/meta:type_traits", "absl/random", "absl/status", @@ -6158,6 +6264,7 @@ grpc_cc_library( ], external_deps = [ "absl/container:inlined_vector", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6202,6 +6309,7 @@ grpc_cc_library( "ext/filters/backend_metrics/backend_metric_filter.h", ], external_deps = [ + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/types:optional", @@ -6242,6 +6350,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6306,6 +6415,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/cleanup", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6347,7 +6457,10 @@ grpc_cc_library( hdrs = [ "resolver/dns/dns_resolver_plugin.h", ], - external_deps = ["absl/strings"], + external_deps = [ + "absl/log:log", + "absl/strings", + ], language = "c++", deps = [ "experiments", @@ -6371,6 +6484,7 @@ grpc_cc_library( ], external_deps = [ "absl/functional:bind_front", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6404,6 +6518,7 @@ grpc_cc_library( "resolver/sockaddr/sockaddr_resolver.cc", ], external_deps = [ + "absl/log:log", "absl/status:statusor", "absl/strings", ], @@ -6428,6 +6543,7 @@ grpc_cc_library( "resolver/binder/binder_resolver.cc", ], external_deps = [ + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6489,6 +6605,7 @@ grpc_cc_library( "absl/container:flat_hash_map", "absl/container:flat_hash_set", "absl/log:check", + "absl/log:log", "absl/strings", ], language = "c++", @@ -6512,6 +6629,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/meta:type_traits", "absl/random", "absl/status", @@ -6573,6 +6691,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/types:optional", @@ -6640,6 +6759,7 @@ grpc_cc_library( external_deps = [ "absl/functional:function_ref", "absl/log:check", + "absl/log:log", "absl/status", "absl/strings", "absl/strings:str_format", @@ -6834,6 +6954,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings:str_format", @@ -6891,6 +7012,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -6952,6 +7074,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -7078,6 +7201,7 @@ grpc_cc_library( external_deps = [ "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/strings", @@ -7131,6 +7255,7 @@ grpc_cc_library( "ext/filters/logging/logging_filter.h", ], external_deps = [ + "absl/log:log", "absl/numeric:int128", "absl/random", "absl/random:distributions", @@ -7209,7 +7334,10 @@ grpc_cc_library( hdrs = [ "ext/transport/chaotic_good/chaotic_good_transport.h", ], - external_deps = ["absl/random"], + external_deps = [ + "absl/log:log", + "absl/random", + ], language = "c++", deps = [ "chaotic_good_frame", @@ -7238,6 +7366,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/container:flat_hash_map", "absl/log:check", + "absl/log:log", "absl/random", "absl/random:bit_gen_ref", "absl/status", @@ -7296,6 +7425,7 @@ grpc_cc_library( "absl/container:flat_hash_map", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/random", "absl/random:bit_gen_ref", "absl/status", @@ -7381,6 +7511,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", ], deps = [ "call_final_info", @@ -7491,6 +7622,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", ], deps = [ "1999", @@ -7628,6 +7760,7 @@ grpc_cc_library( external_deps = [ "absl/container:flat_hash_map", "absl/log:check", + "absl/log:log", "absl/random", "absl/random:bit_gen_ref", "absl/status", @@ -7693,6 +7826,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "absl/random", "absl/random:bit_gen_ref", "absl/status", diff --git a/src/core/ext/transport/binder/transport/binder_transport.cc b/src/core/ext/transport/binder/transport/binder_transport.cc index b5e32e913b7..65512675d96 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.cc +++ b/src/core/ext/transport/binder/transport/binder_transport.cc @@ -24,6 +24,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/substitute.h" @@ -141,7 +142,7 @@ static void AssignMetadata(grpc_metadata_batch* mb, static void cancel_stream_locked(grpc_binder_transport* transport, grpc_binder_stream* stream, grpc_error_handle error) { - gpr_log(GPR_INFO, "cancel_stream_locked"); + LOG(INFO) << "cancel_stream_locked"; if (!stream->is_closed) { CHECK(stream->cancel_self_error.ok()); stream->is_closed = true; @@ -200,7 +201,7 @@ static void recv_initial_metadata_locked(void* arg, CHECK(stream->recv_initial_metadata); CHECK(stream->recv_initial_metadata_ready); if (!args->initial_metadata.ok()) { - gpr_log(GPR_ERROR, "Failed to parse initial metadata"); + LOG(ERROR) << "Failed to parse initial metadata"; return absl_status_to_grpc_error(args->initial_metadata.status()); } if (!stream->is_client) { @@ -237,11 +238,11 @@ static void recv_message_locked(void* arg, grpc_error_handle /*error*/) { CHECK(stream->recv_message); CHECK(stream->recv_message_ready); if (!args->message.ok()) { - gpr_log(GPR_ERROR, "Failed to receive message"); + LOG(ERROR) << "Failed to receive message"; if (args->message.status().message() == grpc_binder::TransportStreamReceiver:: kGrpcBinderTransportCancelledGracefully) { - gpr_log(GPR_ERROR, "message cancelled gracefully"); + LOG(ERROR) << "message cancelled gracefully"; // Cancelled because we've already received trailing metadata. // It's not an error in this case. return absl::OkStatus(); @@ -281,13 +282,13 @@ static void recv_trailing_metadata_locked(void* arg, CHECK(stream->recv_trailing_metadata); CHECK(stream->recv_trailing_metadata_finished); if (!args->trailing_metadata.ok()) { - gpr_log(GPR_ERROR, "Failed to receive trailing metadata"); + LOG(ERROR) << "Failed to receive trailing metadata"; return absl_status_to_grpc_error(args->trailing_metadata.status()); } if (!stream->is_client) { // Client will not send non-empty trailing metadata. if (!args->trailing_metadata.value().empty()) { - gpr_log(GPR_ERROR, "Server receives non-empty trailing metadata."); + LOG(ERROR) << "Server receives non-empty trailing metadata."; return absl::CancelledError(); } } else { @@ -371,7 +372,7 @@ class MetadataEncoder { static void accept_stream_locked(void* gt, grpc_error_handle /*error*/) { grpc_binder_transport* transport = static_cast(gt); if (transport->accept_stream_fn) { - gpr_log(GPR_INFO, "Accepting a stream"); + LOG(INFO) << "Accepting a stream"; // must pass in a non-null value. (*transport->accept_stream_fn)(transport->accept_stream_user_data, transport, transport); @@ -449,7 +450,7 @@ static void perform_stream_op_locked(void* stream_op, std::make_unique(tx_code, transport->is_client); if (op->send_initial_metadata) { - gpr_log(GPR_INFO, "send_initial_metadata"); + LOG(INFO) << "send_initial_metadata"; grpc_binder::Metadata init_md; auto batch = op->payload->send_initial_metadata.send_initial_metadata; @@ -459,12 +460,12 @@ static void perform_stream_op_locked(void* stream_op, tx->SetPrefix(init_md); } if (op->send_message) { - gpr_log(GPR_INFO, "send_message"); + LOG(INFO) << "send_message"; tx->SetData(op->payload->send_message.send_message->JoinIntoString()); } if (op->send_trailing_metadata) { - gpr_log(GPR_INFO, "send_trailing_metadata"); + LOG(INFO) << "send_trailing_metadata"; auto batch = op->payload->send_trailing_metadata.send_trailing_metadata; grpc_binder::Metadata trailing_metadata; @@ -477,7 +478,7 @@ static void perform_stream_op_locked(void* stream_op, tx->SetSuffix(trailing_metadata); } if (op->recv_initial_metadata) { - gpr_log(GPR_INFO, "recv_initial_metadata"); + LOG(INFO) << "recv_initial_metadata"; stream->recv_initial_metadata_ready = op->payload->recv_initial_metadata.recv_initial_metadata_ready; stream->recv_initial_metadata = @@ -500,7 +501,7 @@ static void perform_stream_op_locked(void* stream_op, }); } if (op->recv_message) { - gpr_log(GPR_INFO, "recv_message"); + LOG(INFO) << "recv_message"; stream->recv_message_ready = op->payload->recv_message.recv_message_ready; stream->recv_message = op->payload->recv_message.recv_message; stream->call_failed_before_recv_message = @@ -523,7 +524,7 @@ static void perform_stream_op_locked(void* stream_op, }); } if (op->recv_trailing_metadata) { - gpr_log(GPR_INFO, "recv_trailing_metadata"); + LOG(INFO) << "recv_trailing_metadata"; stream->recv_trailing_metadata_finished = op->payload->recv_trailing_metadata.recv_trailing_metadata_ready; stream->recv_trailing_metadata = @@ -571,7 +572,7 @@ static void perform_stream_op_locked(void* stream_op, if (op->on_complete != nullptr) { grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_complete, absl_status_to_grpc_error(status)); - gpr_log(GPR_INFO, "on_complete closure scheduled"); + LOG(INFO) << "on_complete closure scheduled"; } GRPC_BINDER_STREAM_UNREF(stream, "perform_stream_op"); } diff --git a/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc b/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc index 8595f8bf149..02cd6cf09cd 100644 --- a/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc +++ b/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc @@ -26,6 +26,7 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/status/statusor.h" @@ -136,9 +137,9 @@ void WireReaderImpl::SendSetupTransport(Binder* binder) { std::unique_ptr WireReaderImpl::RecvSetupTransport() { // TODO(b/191941760): avoid blocking, handle wire_writer_noti lifetime // better - gpr_log(GPR_DEBUG, "start waiting for noti"); + VLOG(2) << "start waiting for noti"; connection_noti_.WaitForNotification(); - gpr_log(GPR_DEBUG, "end waiting for noti"); + VLOG(2) << "end waiting for noti"; return std::move(other_end_binder_); } @@ -153,8 +154,8 @@ absl::Status WireReaderImpl::ProcessTransaction(transaction_code_t code, BinderTransportTxCode::SETUP_TRANSPORT) && code <= static_cast( BinderTransportTxCode::PING_RESPONSE))) { - gpr_log(GPR_INFO, - "Received unknown control message. Shutdown transport gracefully."); + LOG(INFO) + << "Received unknown control message. Shutdown transport gracefully."; // TODO(waynetu): Shutdown transport gracefully. return absl::OkStatus(); } @@ -210,8 +211,8 @@ absl::Status WireReaderImpl::ProcessTransaction(transaction_code_t code, break; } case BinderTransportTxCode::SHUTDOWN_TRANSPORT: { - gpr_log(GPR_ERROR, - "Received SHUTDOWN_TRANSPORT request but not implemented yet."); + LOG(ERROR) + << "Received SHUTDOWN_TRANSPORT request but not implemented yet."; return absl::UnimplementedError("SHUTDOWN_TRANSPORT"); } case BinderTransportTxCode::ACKNOWLEDGE_BYTES: { @@ -286,16 +287,16 @@ absl::Status WireReaderImpl::ProcessStreamingTransaction( tx_process_result.ToString().c_str()); // Something went wrong when receiving transaction. Cancel failed requests. if (cancellation_flags & kFlagPrefix) { - gpr_log(GPR_INFO, "cancelling initial metadata"); + LOG(INFO) << "cancelling initial metadata"; transport_stream_receiver_->NotifyRecvInitialMetadata(code, tx_process_result); } if (cancellation_flags & kFlagMessageData) { - gpr_log(GPR_INFO, "cancelling message data"); + LOG(INFO) << "cancelling message data"; transport_stream_receiver_->NotifyRecvMessage(code, tx_process_result); } if (cancellation_flags & kFlagSuffix) { - gpr_log(GPR_INFO, "cancelling trailing metadata"); + LOG(INFO) << "cancelling trailing metadata"; transport_stream_receiver_->NotifyRecvTrailingMetadata( code, tx_process_result, 0); } @@ -338,7 +339,7 @@ absl::Status WireReaderImpl::ProcessStreamingTransactionImpl( // intended behavior. // TODO(waynetu): What should be returned here? if (flags == 0) { - gpr_log(GPR_INFO, "[WARNING] Receive empty transaction. Ignored."); + LOG(INFO) << "[WARNING] Receive empty transaction. Ignored."; return absl::OkStatus(); } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 9a28649dd52..4acd9b51b3f 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -35,6 +35,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/hash/hash.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/meta/type_traits.h" #include "absl/random/random.h" #include "absl/status/status.h" @@ -1324,7 +1325,7 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) { static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id, bool is_client, bool is_initial) { - gpr_log(GPR_INFO, "--metadata--"); + LOG(INFO) << "--metadata--"; const std::string prefix = absl::StrCat( "HTTP:", id, is_initial ? ":HDR" : ":TRL", is_client ? ":CLI:" : ":SVR:"); md_batch->Log([&prefix](absl::string_view key, absl::string_view value) { diff --git a/src/core/ext/transport/cronet/BUILD b/src/core/ext/transport/cronet/BUILD index 50897682381..1e7e8253e62 100644 --- a/src/core/ext/transport/cronet/BUILD +++ b/src/core/ext/transport/cronet/BUILD @@ -41,6 +41,7 @@ grpc_cc_library( ], external_deps = [ "absl/log:check", + "absl/log:log", "cronet_c_for_grpc", ], language = "c++", diff --git a/src/core/lib/gprpp/dump_args.cc b/src/core/lib/gprpp/dump_args.cc new file mode 100644 index 00000000000..e5bc183246b --- /dev/null +++ b/src/core/lib/gprpp/dump_args.cc @@ -0,0 +1,54 @@ +// Copyright 2024 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/core/lib/gprpp/dump_args.h" + +#include "absl/log/check.h" +#include "absl/strings/ascii.h" +#include "absl/strings/string_view.h" + +namespace grpc_core { +namespace dump_args_detail { + +std::ostream& operator<<(std::ostream& out, const DumpArgs& args) { + // Parse the argument string into a vector of keys. + // #__VA_ARGS__ produces a stringified version of the arguments passed to the + // macro. It's comma separated, and we can use that to split the string into + // keys. Those keys might include parenthesis for e.g. argument lists, and so + // we need to skip commas that are inside parenthesis. + std::vector keys; + int depth = 0; + const char* start = args.arg_string_; + for (const char* p = args.arg_string_; *p; ++p) { + if (*p == '(') { + ++depth; + } else if (*p == ')') { + --depth; + } else if (*p == ',' && depth == 0) { + keys.push_back(absl::string_view(start, p - start)); + start = p + 1; + } + } + keys.push_back(start); + CHECK_EQ(keys.size(), args.arg_dumpers_.size()); + for (size_t i = 0; i < keys.size(); i++) { + if (i != 0) out << ", "; + out << absl::StripAsciiWhitespace(keys[i]) << " = "; + args.arg_dumpers_[i](out); + } + return out; +} + +} // namespace dump_args_detail +} // namespace grpc_core \ No newline at end of file diff --git a/src/core/lib/gprpp/dump_args.h b/src/core/lib/gprpp/dump_args.h new file mode 100644 index 00000000000..c2b66ce2be3 --- /dev/null +++ b/src/core/lib/gprpp/dump_args.h @@ -0,0 +1,69 @@ +// Copyright 2024 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H +#define GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H + +#include +#include + +#include "absl/functional/any_invocable.h" + +namespace grpc_core { +namespace dump_args_detail { + +// Helper function... just ignore the initializer list passed into it. +// Allows doing 'statements' via parameter pack expansion in C++11 - given +// template : +// do_these_things({foo()...}); +// will execute foo() for each T in Ts. +template +void do_these_things(std::initializer_list) {} + +class DumpArgs { + public: + template + explicit DumpArgs(const char* arg_string, const Args&... args) + : arg_string_(arg_string) { + do_these_things( + {AddDumper([a = &args](std::ostream& os) { os << *a; })...}); + } + + friend std::ostream& operator<<(std::ostream& out, const DumpArgs& args); + + private: + int AddDumper(absl::AnyInvocable dumper) { + arg_dumpers_.push_back(std::move(dumper)); + return 0; + } + + const char* arg_string_; + std::vector> arg_dumpers_; +}; + +} // namespace dump_args_detail +} // namespace grpc_core + +// Helper to print a list of variables and their values. +// Each type must be streamable to std::ostream. +// Usage: +// int a = 1; +// int b = 2; +// LOG(INFO) << GRPC_DUMP_ARGS(a, b) +// Output: +// a = 1, b = 2 +#define GRPC_DUMP_ARGS(...) \ + grpc_core::dump_args_detail::DumpArgs(#__VA_ARGS__, __VA_ARGS__) + +#endif // GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index c36f3833d9f..6461b10a6cb 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -41,6 +41,7 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" @@ -100,14 +101,14 @@ static int epoll_create_and_cloexec() { #ifdef GRPC_LINUX_EPOLL_CREATE1 int fd = epoll_create1(EPOLL_CLOEXEC); if (fd < 0) { - gpr_log(GPR_ERROR, "epoll_create1 unavailable"); + LOG(ERROR) << "epoll_create1 unavailable"; } #else int fd = epoll_create(MAX_EPOLL_EVENTS); if (fd < 0) { - gpr_log(GPR_ERROR, "epoll_create unavailable"); + LOG(ERROR) << "epoll_create unavailable"; } else if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) { - gpr_log(GPR_ERROR, "fcntl following epoll_create failed"); + LOG(ERROR) << "fcntl following epoll_create failed"; return -1; } #endif @@ -891,7 +892,7 @@ static bool check_neighborhood_for_available_poller( } } else { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. beaten to choose next poller"); + LOG(INFO) << " .. beaten to choose next poller"; } } // even if we didn't win the cas, there's a worker, we can stop @@ -990,7 +991,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, gpr_cv_destroy(&worker->cv); } if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. remove worker"); + LOG(INFO) << " .. remove worker"; } if (EMPTIED == worker_remove(pollset, worker)) { pollset_maybe_finish_shutdown(pollset); @@ -1081,7 +1082,7 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset, if (root_worker == nullptr) { pollset->kicked_without_poller = true; if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. kicked_without_poller"); + LOG(INFO) << " .. kicked_without_poller"; } goto done; } @@ -1146,7 +1147,7 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset, } } else { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. kicked while waking up"); + LOG(INFO) << " .. kicked while waking up"; } goto done; } @@ -1156,7 +1157,7 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset, if (specific_worker->state == KICKED) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. specific worker already kicked"); + LOG(INFO) << " .. specific worker already kicked"; } goto done; } else if (g_current_thread_worker == specific_worker) { @@ -1169,21 +1170,21 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset, reinterpret_cast( gpr_atm_no_barrier_load(&g_active_poller))) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. kick active poller"); + LOG(INFO) << " .. kick active poller"; } SET_KICK_STATE(specific_worker, KICKED); ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd); goto done; } else if (specific_worker->initialized_cv) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. kick waiting worker"); + LOG(INFO) << " .. kick waiting worker"; } SET_KICK_STATE(specific_worker, KICKED); gpr_cv_signal(&specific_worker->cv); goto done; } else { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { - gpr_log(GPR_INFO, " .. kick non-waiting worker"); + LOG(INFO) << " .. kick non-waiting worker"; } SET_KICK_STATE(specific_worker, KICKED); goto done; @@ -1311,7 +1312,7 @@ static void reset_event_manager_on_fork() { static bool init_epoll1_linux() { if (!g_is_shutdown) return true; if (!grpc_has_wakeup_fd()) { - gpr_log(GPR_ERROR, "Skipping epoll1 because of no wakeup fd."); + LOG(ERROR) << "Skipping epoll1 because of no wakeup fd."; return false; } diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 880b10c1764..46c54c9502e 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -46,6 +46,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -212,7 +213,7 @@ class TcpZerocopySendCtx { if (send_records_ == nullptr || free_send_records_ == nullptr) { gpr_free(send_records_); gpr_free(free_send_records_); - gpr_log(GPR_INFO, "Disabling TCP TX zerocopy due to memory pressure.\n"); + LOG(INFO) << "Disabling TCP TX zerocopy due to memory pressure.\n"; memory_limited_ = true; } else { for (int idx = 0; idx < max_sends_; ++idx) { @@ -836,7 +837,7 @@ static void tcp_destroy(grpc_endpoint* ep) { static void perform_reclamation(grpc_tcp* tcp) ABSL_LOCKS_EXCLUDED(tcp->read_mu) { if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) { - gpr_log(GPR_INFO, "TCP: benign reclamation to free memory"); + LOG(INFO) << "TCP: benign reclamation to free memory"; } tcp->read_mu.Lock(); if (tcp->incoming_buffer != nullptr) { @@ -1294,7 +1295,7 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg, if (setsockopt(tcp->fd, SOL_SOCKET, SO_TIMESTAMPING, static_cast(&opt), sizeof(opt)) != 0) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_ERROR, "Failed to set timestamping options on the socket."); + LOG(ERROR) << "Failed to set timestamping options on the socket."; } return false; } @@ -1380,7 +1381,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, cmsghdr* opt_stats = nullptr; if (next_cmsg == nullptr) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_ERROR, "Received timestamp without extended error"); + LOG(ERROR) << "Received timestamp without extended error"; } return cmsg; } @@ -1392,7 +1393,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, next_cmsg = CMSG_NXTHDR(msg, opt_stats); if (next_cmsg == nullptr) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_ERROR, "Received timestamp without extended error"); + LOG(ERROR) << "Received timestamp without extended error"; } return opt_stats; } @@ -1402,7 +1403,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, !(next_cmsg->cmsg_type == IP_RECVERR || next_cmsg->cmsg_type == IPV6_RECVERR)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_ERROR, "Unexpected control message"); + LOG(ERROR) << "Unexpected control message"; } return cmsg; } @@ -1412,7 +1413,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, auto serr = reinterpret_cast(CMSG_DATA(next_cmsg)); if (serr->ee_errno != ENOMSG || serr->ee_origin != SO_EE_ORIGIN_TIMESTAMPING) { - gpr_log(GPR_ERROR, "Unexpected control message"); + LOG(ERROR) << "Unexpected control message"; return cmsg; } tcp->tb_list.ProcessTimestamp(serr, opt_stats, tss); @@ -1462,7 +1463,7 @@ static bool process_errors(grpc_tcp* tcp) { return processed_err; } if (GPR_UNLIKELY((msg.msg_flags & MSG_CTRUNC) != 0)) { - gpr_log(GPR_ERROR, "Error message was truncated."); + LOG(ERROR) << "Error message was truncated."; } if (msg.msg_controllen == 0) { @@ -1539,14 +1540,14 @@ static bool tcp_write_with_timestamps(grpc_tcp* /*tcp*/, struct msghdr* /*msg*/, ssize_t* /*sent_length*/, int* /* saved_errno */, int /*additional_flags*/) { - gpr_log(GPR_ERROR, "Write with timestamps not supported for this platform"); + LOG(ERROR) << "Write with timestamps not supported for this platform"; CHECK(0); return false; } static void tcp_handle_error(void* /*arg*/ /* grpc_tcp */, grpc_error_handle /*error*/) { - gpr_log(GPR_ERROR, "Error handling is not supported for this platform"); + LOG(ERROR) << "Error handling is not supported for this platform"; CHECK(0); } #endif // GRPC_LINUX_ERRQUEUE @@ -1842,7 +1843,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, : tcp_flush(tcp, &error); if (!flush_result) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_INFO, "write: delayed"); + LOG(INFO) << "write: delayed"; } notify_on_write(tcp); // tcp_flush does not populate error if it has returned false. @@ -1915,7 +1916,7 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf, tcp->write_cb = cb; tcp->current_zerocopy_send = zerocopy_send_record; if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_INFO, "write: delayed"); + LOG(INFO) << "write: delayed"; } notify_on_write(tcp); } else { @@ -2029,7 +2030,7 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd, if (err == 0) { tcp->tcp_zerocopy_send_ctx.set_enabled(true); } else { - gpr_log(GPR_ERROR, "Failed to set zerocopy options on the socket."); + LOG(ERROR) << "Failed to set zerocopy options on the socket."; } #endif } diff --git a/src/core/lib/promise/detail/seq_state.h b/src/core/lib/promise/detail/seq_state.h index 3e69e60b741..841cd6cb042 100644 --- a/src/core/lib/promise/detail/seq_state.h +++ b/src/core/lib/promise/detail/seq_state.h @@ -23,6 +23,7 @@ #include "absl/base/attributes.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include @@ -144,22 +145,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/2", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/2"; } auto result = prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/2 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/2 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -177,14 +177,14 @@ struct SeqState { default: case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/2", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/2"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/2 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/2 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -287,22 +287,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/3", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/3"; } auto result = prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/3 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/3 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -319,22 +318,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/3", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/3"; } auto result = prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/3 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/3 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -352,14 +350,14 @@ struct SeqState { default: case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/3", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/3"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/3 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/3 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -489,22 +487,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/4", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/4"; } auto result = prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/4 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/4 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -521,22 +518,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/4", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/4"; } auto result = prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/4 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/4 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -553,22 +549,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/4", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/4"; } auto result = prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/4 gets %s", this, - p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/4 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits2::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { @@ -586,14 +581,14 @@ struct SeqState { default: case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 4/4", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/4"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 4/4 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/4 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -751,22 +746,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/5", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/5"; } auto result = prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/5 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/5 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -783,22 +777,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/5", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/5"; } auto result = prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/5 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/5 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -815,22 +808,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/5", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/5"; } auto result = prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/5 gets %s", this, - p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/5 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits2::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { @@ -847,22 +839,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 4/5", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/5"; } auto result = prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 4/5 gets %s", this, - p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/5 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits3::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { @@ -880,14 +871,14 @@ struct SeqState { default: case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 5/5", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/5"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 5/5 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/5 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -1082,22 +1073,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/6", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/6"; } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/6 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/6 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -1115,22 +1105,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/6", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/6"; } auto result = prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/6 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/6 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -1147,22 +1136,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/6", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/6"; } auto result = prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/6 gets %s", this, - p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/6 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits2::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { @@ -1179,22 +1167,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 4/6", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/6"; } auto result = prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 4/6 gets %s", this, - p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/6 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits3::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { @@ -1211,22 +1198,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 5/6", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/6"; } auto result = prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 5/6 gets %s", this, - p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/6 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits4::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { @@ -1249,9 +1235,9 @@ struct SeqState { } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 6/6 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/6 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -1478,22 +1464,21 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/7"; } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/7 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -1511,22 +1496,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/7"; } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/7 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -1544,22 +1528,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/7"; } auto result = prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/7 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits2::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { @@ -1576,22 +1559,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 4/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/7"; } auto result = prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 4/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/7 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits3::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { @@ -1608,22 +1590,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 5/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/7"; } auto result = prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 5/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/7 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits4::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { @@ -1640,22 +1621,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 6/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/7"; } auto result = prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 6/7 gets %s", this, - p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/7 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits5::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { @@ -1673,14 +1653,14 @@ struct SeqState { default: case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 7/7", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/7"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 7/7 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/7 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -1940,23 +1920,22 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 1/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/8"; } auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 1/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/8 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits0::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { @@ -1975,22 +1954,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 2/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/8"; } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 2/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/8 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits1::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { @@ -2008,22 +1986,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 3/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/8"; } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 3/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/8 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits2::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { @@ -2041,22 +2018,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 4/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/8"; } auto result = prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 4/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/8 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits3::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { @@ -2073,22 +2049,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 5/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/8"; } auto result = prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 5/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/8 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits4::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { @@ -2105,22 +2080,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 6/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/8"; } auto result = prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 6/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/8 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits5::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { @@ -2137,22 +2111,21 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 7/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/8"; } auto result = prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 7/8 gets %s", this, - p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/8 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits6::ErrorString(*p))) + : "pending"); } if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { @@ -2170,14 +2143,14 @@ struct SeqState { default: case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: begin poll step 8/8", this); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/8"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, - "seq[%p]: poll step 8/8 gets %s", this, - result.ready() ? "ready" : "pending"); + LOG(INFO).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/8 gets " + << (result.ready() ? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index 0e927aa075d..49cc8e21be1 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -42,6 +42,7 @@ #endif #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" @@ -114,7 +115,7 @@ static const EVP_MD* evp_md_from_alg(const char* alg) { static Json parse_json_part_from_jwt(const char* str, size_t len) { std::string string; if (!absl::WebSafeBase64Unescape(absl::string_view(str, len), &string)) { - gpr_log(GPR_ERROR, "Invalid base64."); + LOG(ERROR) << "Invalid base64."; return Json(); // JSON null } auto json = grpc_core::JsonParse(string); @@ -163,13 +164,13 @@ static jose_header* jose_header_from_json(Json json) { Json::Object::const_iterator it; jose_header* h = grpc_core::Zalloc(); if (json.type() != Json::Type::kObject) { - gpr_log(GPR_ERROR, "JSON value is not an object"); + LOG(ERROR) << "JSON value is not an object"; goto error; } // Check alg field. it = json.object().find("alg"); if (it == json.object().end()) { - gpr_log(GPR_ERROR, "Missing alg field."); + LOG(ERROR) << "Missing alg field."; goto error; } // We only support RSA-1.5 signatures for now. @@ -180,7 +181,7 @@ static jose_header* jose_header_from_json(Json json) { if (it->second.type() != Json::Type::kString || strncmp(alg_value, "RS", 2) != 0 || evp_md_from_alg(alg_value) == nullptr) { - gpr_log(GPR_ERROR, "Invalid alg field"); + LOG(ERROR) << "Invalid alg field"; goto error; } h->alg = alg_value; @@ -319,13 +320,13 @@ grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims* claims, skewed_now = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_clock_skew); if (gpr_time_cmp(skewed_now, claims->nbf) < 0) { - gpr_log(GPR_ERROR, "JWT is not valid yet."); + LOG(ERROR) << "JWT is not valid yet."; return GRPC_JWT_VERIFIER_TIME_CONSTRAINT_FAILURE; } skewed_now = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_clock_skew); if (gpr_time_cmp(skewed_now, claims->exp) > 0) { - gpr_log(GPR_ERROR, "JWT is expired."); + LOG(ERROR) << "JWT is expired."; return GRPC_JWT_VERIFIER_TIME_CONSTRAINT_FAILURE; } @@ -430,7 +431,7 @@ struct grpc_jwt_verifier { static Json json_from_http(const grpc_http_response* response) { if (response == nullptr) { - gpr_log(GPR_ERROR, "HTTP response is NULL."); + LOG(ERROR) << "HTTP response is NULL."; return Json(); // JSON null } if (response->status != 200) { @@ -441,7 +442,7 @@ static Json json_from_http(const grpc_http_response* response) { auto json = grpc_core::JsonParse( absl::string_view(response->body, response->body_length)); if (!json.ok()) { - gpr_log(GPR_ERROR, "Invalid JSON found in response."); + LOG(ERROR) << "Invalid JSON found in response."; return Json(); // JSON null } return std::move(*json); @@ -464,12 +465,12 @@ static EVP_PKEY* extract_pkey_from_x509(const char* x509_str) { BIO_write(bio, x509_str, static_cast(len)); x509 = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); if (x509 == nullptr) { - gpr_log(GPR_ERROR, "Unable to parse x509 cert."); + LOG(ERROR) << "Unable to parse x509 cert."; goto end; } result = X509_get_pubkey(x509); if (result == nullptr) { - gpr_log(GPR_ERROR, "Cannot find public key in X509 cert."); + LOG(ERROR) << "Cannot find public key in X509 cert."; } end: @@ -482,7 +483,7 @@ static BIGNUM* bignum_from_base64(const char* b64) { if (b64 == nullptr) return nullptr; std::string string; if (!absl::WebSafeBase64Unescape(b64, &string)) { - gpr_log(GPR_ERROR, "Invalid base64 for big num."); + LOG(ERROR) << "Invalid base64 for big num."; return nullptr; } return BN_bin2bn(reinterpret_cast(string.data()), @@ -540,27 +541,27 @@ static EVP_PKEY* pkey_from_jwk(const Json& json, const char* kty) { #if OPENSSL_VERSION_NUMBER < 0x30000000L rsa = RSA_new(); if (rsa == nullptr) { - gpr_log(GPR_ERROR, "Could not create rsa key."); + LOG(ERROR) << "Could not create rsa key."; goto end; } #endif it = json.object().find("n"); if (it == json.object().end()) { - gpr_log(GPR_ERROR, "Missing RSA public key field."); + LOG(ERROR) << "Missing RSA public key field."; goto end; } tmp_n = bignum_from_base64(validate_string_field(it->second, "n")); if (tmp_n == nullptr) goto end; it = json.object().find("e"); if (it == json.object().end()) { - gpr_log(GPR_ERROR, "Missing RSA public key field."); + LOG(ERROR) << "Missing RSA public key field."; goto end; } tmp_e = bignum_from_base64(validate_string_field(it->second, "e")); if (tmp_e == nullptr) goto end; #if OPENSSL_VERSION_NUMBER < 0x30000000L if (!RSA_set0_key(rsa, tmp_n, tmp_e, nullptr)) { - gpr_log(GPR_ERROR, "Cannot set RSA key from inputs."); + LOG(ERROR) << "Cannot set RSA key from inputs."; goto end; } // RSA_set0_key takes ownership on success. @@ -573,21 +574,21 @@ static EVP_PKEY* pkey_from_jwk(const Json& json, const char* kty) { if (!OSSL_PARAM_BLD_push_BN(bld, "n", tmp_n) || !OSSL_PARAM_BLD_push_BN(bld, "e", tmp_e) || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL) { - gpr_log(GPR_ERROR, "Could not create OSSL_PARAM"); + LOG(ERROR) << "Could not create OSSL_PARAM"; goto end; } ctx = EVP_PKEY_CTX_new_from_name(nullptr, "RSA", nullptr); if (ctx == nullptr) { - gpr_log(GPR_ERROR, "Could not create rsa key."); + LOG(ERROR) << "Could not create rsa key."; goto end; } if (EVP_PKEY_fromdata_init(ctx) <= 0) { - gpr_log(GPR_ERROR, "Could not create rsa key."); + LOG(ERROR) << "Could not create rsa key."; goto end; } if (EVP_PKEY_fromdata(ctx, &result, EVP_PKEY_KEYPAIR, params) <= 0) { - gpr_log(GPR_ERROR, "Cannot set RSA key from inputs."); + LOG(ERROR) << "Cannot set RSA key from inputs."; goto end; } #endif @@ -618,8 +619,7 @@ static EVP_PKEY* find_verification_key(const Json& json, const char* header_alg, return extract_pkey_from_x509(cur->string().c_str()); } if (jwt_keys->type() != Json::Type::kArray) { - gpr_log(GPR_ERROR, - "Unexpected value type of keys property in jwks key set."); + LOG(ERROR) << "Unexpected value type of keys property in jwks key set."; return nullptr; } // Key format is specified in: @@ -661,21 +661,21 @@ static int verify_jwt_signature(EVP_PKEY* key, const char* alg, CHECK_NE(md, nullptr); // Checked before. if (md_ctx == nullptr) { - gpr_log(GPR_ERROR, "Could not create EVP_MD_CTX."); + LOG(ERROR) << "Could not create EVP_MD_CTX."; goto end; } if (EVP_DigestVerifyInit(md_ctx, nullptr, md, nullptr, key) != 1) { - gpr_log(GPR_ERROR, "EVP_DigestVerifyInit failed."); + LOG(ERROR) << "EVP_DigestVerifyInit failed."; goto end; } if (EVP_DigestVerifyUpdate(md_ctx, GRPC_SLICE_START_PTR(signed_data), GRPC_SLICE_LENGTH(signed_data)) != 1) { - gpr_log(GPR_ERROR, "EVP_DigestVerifyUpdate failed."); + LOG(ERROR) << "EVP_DigestVerifyUpdate failed."; goto end; } if (EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(signature), GRPC_SLICE_LENGTH(signature)) != 1) { - gpr_log(GPR_ERROR, "JWT signature verification failed."); + LOG(ERROR) << "JWT signature verification failed."; goto end; } @@ -742,7 +742,7 @@ static void on_openid_config_retrieved(void* user_data, if (json.type() == Json::Type::kNull) goto error; cur = find_property_by_name(json, "jwks_uri"); if (cur == nullptr) { - gpr_log(GPR_ERROR, "Could not find jwks_uri in openid config."); + LOG(ERROR) << "Could not find jwks_uri in openid config."; goto error; } jwks_uri = validate_string_field(*cur, "jwks_uri"); @@ -843,11 +843,11 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) { CHECK(ctx != nullptr && ctx->header != nullptr && ctx->claims != nullptr); iss = ctx->claims->iss; if (ctx->header->kid == nullptr) { - gpr_log(GPR_ERROR, "Missing kid in jose header."); + LOG(ERROR) << "Missing kid in jose header."; goto error; } if (iss == nullptr) { - gpr_log(GPR_ERROR, "Missing iss in claims."); + LOG(ERROR) << "Missing iss in claims."; goto error; } @@ -862,7 +862,7 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) { CHECK_NE(ctx->verifier, nullptr); mapping = verifier_get_mapping(ctx->verifier, email_domain); if (mapping == nullptr) { - gpr_log(GPR_ERROR, "Missing mapping for issuer email."); + LOG(ERROR) << "Missing mapping for issuer email."; goto error; } host = gpr_strdup(mapping->key_url_prefix); diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 04fdf2358d3..e8765746118 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -34,6 +34,7 @@ #include "absl/base/thread_annotations.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -421,6 +422,9 @@ class ChannelBasedCall : public Call { Channel* channel() const { return channel_.get(); } + // Non-virtual arena accessor -- needed by PipeBasedCall + Arena* GetArena() { return arena_; } + private: Arena* const arena_; RefCountedPtr channel_; @@ -1163,8 +1167,7 @@ void FilterStackCall::RecvTrailingFilter(grpc_metadata_batch* b, } else if (!is_client()) { SetFinalStatus(absl::OkStatus()); } else { - gpr_log(GPR_DEBUG, - "Received trailing metadata with no error and no status"); + VLOG(2) << "Received trailing metadata with no error and no status"; SetFinalStatus(grpc_error_set_int(GRPC_ERROR_CREATE("No status received"), StatusIntProperty::kRpcStatus, GRPC_STATUS_UNKNOWN)); @@ -2800,12 +2803,12 @@ class ClientPromiseBasedCall final : public PromiseBasedCall { void PublishInitialMetadata(ServerMetadata* metadata); ClientMetadataHandle send_initial_metadata_; - Pipe server_initial_metadata_{arena()}; + Pipe server_initial_metadata_{GetArena()}; Latch server_trailing_metadata_; Latch cancel_error_; Latch polling_entity_; - Pipe client_to_server_messages_{arena()}; - Pipe server_to_client_messages_{arena()}; + Pipe client_to_server_messages_{GetArena()}; + Pipe server_to_client_messages_{GetArena()}; bool is_trailers_only_ = false; bool scheduled_receive_status_ = false; bool scheduled_send_close_ = false; @@ -3344,6 +3347,10 @@ class MaybeOpImpl { return r; } } +<<<<<<< HEAD +======= + GPR_UNREACHABLE_CODE(return Pending{}); +>>>>>>> transport-refs-2 } private: diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index ac2cc186cd8..5dbe2c6695f 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -523,7 +523,7 @@ class Transport : public InternallyRefCounted { // not. // TODO(ctiller): consider moving to a DualRefCounted model (with the // disadvantage that we would accidentally have many strong owners which is - // unneccessary for this type). + // unnecessary for this type). RefCountedPtr Ref() { return InternallyRefCounted::Ref(); } diff --git a/src/core/load_balancing/xds/xds_override_host.cc b/src/core/load_balancing/xds/xds_override_host.cc index c8821ca0a91..41b3eb36ef6 100644 --- a/src/core/load_balancing/xds/xds_override_host.cc +++ b/src/core/load_balancing/xds/xds_override_host.cc @@ -32,6 +32,7 @@ #include "absl/base/thread_annotations.h" #include "absl/functional/function_ref.h" #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" @@ -530,7 +531,7 @@ XdsOverrideHostLb::Picker::PickOverridenHost( // a connection attempt and queue the pick until that attempt completes. if (idle_subchannel != nullptr) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_override_host_trace)) { - gpr_log(GPR_INFO, "Picker override found IDLE subchannel"); + LOG(INFO) << "Picker override found IDLE subchannel"; } // Deletes itself after the connection is requested. new SubchannelConnectionRequester(std::move(idle_subchannel)); @@ -540,7 +541,7 @@ XdsOverrideHostLb::Picker::PickOverridenHost( // queue the pick and wait for the connection attempt to complete. if (found_connecting) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_override_host_trace)) { - gpr_log(GPR_INFO, "Picker override found CONNECTING subchannel"); + LOG(INFO) << "Picker override found CONNECTING subchannel"; } return PickResult::Queue(); } @@ -549,7 +550,7 @@ XdsOverrideHostLb::Picker::PickOverridenHost( // creation of a subchannel for that entry. if (!address_with_no_subchannel.empty()) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_override_host_trace)) { - gpr_log(GPR_INFO, "Picker override found entry with no subchannel"); + LOG(INFO) << "Picker override found entry with no subchannel"; } if (!IsWorkSerializerDispatchEnabled()) { new SubchannelCreationRequester(policy_, address_with_no_subchannel); diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc index 11849b655b8..fa22ca884b7 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc @@ -23,6 +23,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "upb/mem/arena.hpp" #include @@ -87,7 +88,7 @@ typedef struct alts_tsi_handshaker_result { static tsi_result handshaker_result_extract_peer( const tsi_handshaker_result* self, tsi_peer* peer) { if (self == nullptr || peer == nullptr) { - gpr_log(GPR_ERROR, "Invalid argument to handshaker_result_extract_peer()"); + LOG(ERROR) << "Invalid argument to handshaker_result_extract_peer()"; return TSI_INVALID_ARGUMENT; } alts_tsi_handshaker_result* result = @@ -97,7 +98,7 @@ static tsi_result handshaker_result_extract_peer( tsi_result ok = tsi_construct_peer(kTsiAltsNumOfPeerProperties, peer); int index = 0; if (ok != TSI_OK) { - gpr_log(GPR_ERROR, "Failed to construct tsi peer"); + LOG(ERROR) << "Failed to construct tsi peer"; return ok; } CHECK_NE(&peer->properties[index], nullptr); @@ -106,7 +107,7 @@ static tsi_result handshaker_result_extract_peer( &peer->properties[index]); if (ok != TSI_OK) { tsi_peer_destruct(peer); - gpr_log(GPR_ERROR, "Failed to set tsi peer property"); + LOG(ERROR) << "Failed to set tsi peer property"; return ok; } index++; @@ -116,7 +117,7 @@ static tsi_result handshaker_result_extract_peer( &peer->properties[index]); if (ok != TSI_OK) { tsi_peer_destruct(peer); - gpr_log(GPR_ERROR, "Failed to set tsi peer property"); + LOG(ERROR) << "Failed to set tsi peer property"; } index++; CHECK_NE(&peer->properties[index], nullptr); @@ -126,7 +127,7 @@ static tsi_result handshaker_result_extract_peer( GRPC_SLICE_LENGTH(result->rpc_versions), &peer->properties[index]); if (ok != TSI_OK) { tsi_peer_destruct(peer); - gpr_log(GPR_ERROR, "Failed to set tsi peer property"); + LOG(ERROR) << "Failed to set tsi peer property"; } index++; CHECK_NE(&peer->properties[index], nullptr); @@ -136,7 +137,7 @@ static tsi_result handshaker_result_extract_peer( GRPC_SLICE_LENGTH(result->serialized_context), &peer->properties[index]); if (ok != TSI_OK) { tsi_peer_destruct(peer); - gpr_log(GPR_ERROR, "Failed to set tsi peer property"); + LOG(ERROR) << "Failed to set tsi peer property"; } index++; CHECK_NE(&peer->properties[index], nullptr); @@ -146,7 +147,7 @@ static tsi_result handshaker_result_extract_peer( &peer->properties[index]); if (ok != TSI_OK) { tsi_peer_destruct(peer); - gpr_log(GPR_ERROR, "Failed to set tsi peer property"); + LOG(ERROR) << "Failed to set tsi peer property"; } CHECK(++index == kTsiAltsNumOfPeerProperties); return ok; @@ -163,8 +164,7 @@ static tsi_result handshaker_result_create_zero_copy_grpc_protector( const tsi_handshaker_result* self, size_t* max_output_protected_frame_size, tsi_zero_copy_grpc_protector** protector) { if (self == nullptr || protector == nullptr) { - gpr_log(GPR_ERROR, - "Invalid arguments to create_zero_copy_grpc_protector()"); + LOG(ERROR) << "Invalid arguments to create_zero_copy_grpc_protector()"; return TSI_INVALID_ARGUMENT; } alts_tsi_handshaker_result* result = @@ -198,7 +198,7 @@ static tsi_result handshaker_result_create_zero_copy_grpc_protector( /*is_integrity_only=*/false, /*enable_extra_copy=*/false, max_output_protected_frame_size, protector); if (ok != TSI_OK) { - gpr_log(GPR_ERROR, "Failed to create zero-copy grpc protector"); + LOG(ERROR) << "Failed to create zero-copy grpc protector"; } return ok; } @@ -207,8 +207,8 @@ static tsi_result handshaker_result_create_frame_protector( const tsi_handshaker_result* self, size_t* max_output_protected_frame_size, tsi_frame_protector** protector) { if (self == nullptr || protector == nullptr) { - gpr_log(GPR_ERROR, - "Invalid arguments to handshaker_result_create_frame_protector()"); + LOG(ERROR) + << "Invalid arguments to handshaker_result_create_frame_protector()"; return TSI_INVALID_ARGUMENT; } alts_tsi_handshaker_result* result = @@ -219,7 +219,7 @@ static tsi_result handshaker_result_create_frame_protector( kAltsAes128GcmRekeyKeyLength, result->is_client, /*is_rekey=*/true, max_output_protected_frame_size, protector); if (ok != TSI_OK) { - gpr_log(GPR_ERROR, "Failed to create frame protector"); + LOG(ERROR) << "Failed to create frame protector"; } return ok; } @@ -228,8 +228,7 @@ static tsi_result handshaker_result_get_unused_bytes( const tsi_handshaker_result* self, const unsigned char** bytes, size_t* bytes_size) { if (self == nullptr || bytes == nullptr || bytes_size == nullptr) { - gpr_log(GPR_ERROR, - "Invalid arguments to handshaker_result_get_unused_bytes()"); + LOG(ERROR) << "Invalid arguments to handshaker_result_get_unused_bytes()"; return TSI_INVALID_ARGUMENT; } alts_tsi_handshaker_result* result = @@ -267,7 +266,7 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, bool is_client, tsi_handshaker_result** result) { if (result == nullptr || resp == nullptr) { - gpr_log(GPR_ERROR, "Invalid arguments to create_handshaker_result()"); + LOG(ERROR) << "Invalid arguments to create_handshaker_result()"; return TSI_INVALID_ARGUMENT; } const grpc_gcp_HandshakerResult* hresult = @@ -275,42 +274,42 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, const grpc_gcp_Identity* identity = grpc_gcp_HandshakerResult_peer_identity(hresult); if (identity == nullptr) { - gpr_log(GPR_ERROR, "Invalid identity"); + LOG(ERROR) << "Invalid identity"; return TSI_FAILED_PRECONDITION; } upb_StringView peer_service_account = grpc_gcp_Identity_service_account(identity); if (peer_service_account.size == 0) { - gpr_log(GPR_ERROR, "Invalid peer service account"); + LOG(ERROR) << "Invalid peer service account"; return TSI_FAILED_PRECONDITION; } upb_StringView key_data = grpc_gcp_HandshakerResult_key_data(hresult); if (key_data.size < kAltsAes128GcmRekeyKeyLength) { - gpr_log(GPR_ERROR, "Bad key length"); + LOG(ERROR) << "Bad key length"; return TSI_FAILED_PRECONDITION; } const grpc_gcp_RpcProtocolVersions* peer_rpc_version = grpc_gcp_HandshakerResult_peer_rpc_versions(hresult); if (peer_rpc_version == nullptr) { - gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions."); + LOG(ERROR) << "Peer does not set RPC protocol versions."; return TSI_FAILED_PRECONDITION; } upb_StringView application_protocol = grpc_gcp_HandshakerResult_application_protocol(hresult); if (application_protocol.size == 0) { - gpr_log(GPR_ERROR, "Invalid application protocol"); + LOG(ERROR) << "Invalid application protocol"; return TSI_FAILED_PRECONDITION; } upb_StringView record_protocol = grpc_gcp_HandshakerResult_record_protocol(hresult); if (record_protocol.size == 0) { - gpr_log(GPR_ERROR, "Invalid record protocol"); + LOG(ERROR) << "Invalid record protocol"; return TSI_FAILED_PRECONDITION; } const grpc_gcp_Identity* local_identity = grpc_gcp_HandshakerResult_local_identity(hresult); if (local_identity == nullptr) { - gpr_log(GPR_ERROR, "Invalid local identity"); + LOG(ERROR) << "Invalid local identity"; return TSI_FAILED_PRECONDITION; } upb_StringView local_service_account = @@ -331,7 +330,7 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, bool serialized = grpc_gcp_rpc_protocol_versions_encode( peer_rpc_version, rpc_versions_arena.ptr(), &sresult->rpc_versions); if (!serialized) { - gpr_log(GPR_ERROR, "Failed to serialize peer's RPC protocol versions."); + LOG(ERROR) << "Failed to serialize peer's RPC protocol versions."; return TSI_FAILED_PRECONDITION; } upb::Arena context_arena; @@ -348,7 +347,7 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, context, const_cast(peer_rpc_version)); grpc_gcp_Identity* peer_identity = const_cast(identity); if (peer_identity == nullptr) { - gpr_log(GPR_ERROR, "Null peer identity in ALTS context."); + LOG(ERROR) << "Null peer identity in ALTS context."; return TSI_FAILED_PRECONDITION; } if (grpc_gcp_Identity_attributes_size(identity) != 0) { @@ -372,7 +371,7 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, char* serialized_ctx = grpc_gcp_AltsContext_serialize( context, context_arena.ptr(), &serialized_ctx_length); if (serialized_ctx == nullptr) { - gpr_log(GPR_ERROR, "Failed to serialize peer's ALTS context."); + LOG(ERROR) << "Failed to serialize peer's ALTS context."; return TSI_FAILED_PRECONDITION; } sresult->serialized_context = @@ -388,7 +387,7 @@ static void on_handshaker_service_resp_recv(void* arg, grpc_error_handle error) { alts_handshaker_client* client = static_cast(arg); if (client == nullptr) { - gpr_log(GPR_ERROR, "ALTS handshaker client is nullptr"); + LOG(ERROR) << "ALTS handshaker client is nullptr"; return; } bool success = true; @@ -440,7 +439,7 @@ static tsi_result alts_tsi_handshaker_continue_handshaker_next( handshaker->client_vtable_for_testing, handshaker->is_client, handshaker->max_frame_size, error); if (client == nullptr) { - gpr_log(GPR_ERROR, "Failed to create ALTS handshaker client"); + LOG(ERROR) << "Failed to create ALTS handshaker client"; if (error != nullptr) *error = "Failed to create ALTS handshaker client"; return TSI_FAILED_PRECONDITION; } @@ -449,7 +448,7 @@ static tsi_result alts_tsi_handshaker_continue_handshaker_next( CHECK_EQ(handshaker->client, nullptr); handshaker->client = client; if (handshaker->shutdown) { - gpr_log(GPR_INFO, "TSI handshake shutdown"); + LOG(INFO) << "TSI handshake shutdown"; if (error != nullptr) *error = "TSI handshaker shutdown"; return TSI_HANDSHAKE_SHUTDOWN; } @@ -529,7 +528,7 @@ static tsi_result handshaker_next( size_t* /*bytes_to_send_size*/, tsi_handshaker_result** /*result*/, tsi_handshaker_on_next_done_cb cb, void* user_data, std::string* error) { if (self == nullptr || cb == nullptr) { - gpr_log(GPR_ERROR, "Invalid arguments to handshaker_next()"); + LOG(ERROR) << "Invalid arguments to handshaker_next()"; if (error != nullptr) *error = "invalid argument"; return TSI_INVALID_ARGUMENT; } @@ -538,7 +537,7 @@ static tsi_result handshaker_next( { grpc_core::MutexLock lock(&handshaker->mu); if (handshaker->shutdown) { - gpr_log(GPR_INFO, "TSI handshake shutdown"); + LOG(INFO) << "TSI handshake shutdown"; if (error != nullptr) *error = "handshake shutdown"; return TSI_HANDSHAKE_SHUTDOWN; } @@ -569,7 +568,7 @@ static tsi_result handshaker_next( tsi_result ok = alts_tsi_handshaker_continue_handshaker_next( handshaker, received_bytes, received_bytes_size, cb, user_data, error); if (ok != TSI_OK) { - gpr_log(GPR_ERROR, "Failed to schedule ALTS handshaker requests"); + LOG(ERROR) << "Failed to schedule ALTS handshaker requests"; return ok; } } @@ -651,7 +650,7 @@ tsi_result alts_tsi_handshaker_create( size_t user_specified_max_frame_size) { if (handshaker_service_url == nullptr || self == nullptr || options == nullptr || (is_client && target_name == nullptr)) { - gpr_log(GPR_ERROR, "Invalid arguments to alts_tsi_handshaker_create()"); + LOG(ERROR) << "Invalid arguments to alts_tsi_handshaker_create()"; return TSI_INVALID_ARGUMENT; } bool use_dedicated_cq = interested_parties == nullptr; diff --git a/src/cpp/ext/csm/BUILD b/src/cpp/ext/csm/BUILD index fda0e37dbe8..6ee6bef1d4a 100644 --- a/src/cpp/ext/csm/BUILD +++ b/src/cpp/ext/csm/BUILD @@ -42,6 +42,7 @@ grpc_cc_library( external_deps = [ "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status:statusor", "absl/strings", "absl/types:optional", diff --git a/src/cpp/ext/gcp/BUILD b/src/cpp/ext/gcp/BUILD index a95fe68b71c..814bf9012a2 100644 --- a/src/cpp/ext/gcp/BUILD +++ b/src/cpp/ext/gcp/BUILD @@ -115,6 +115,7 @@ grpc_cc_library( ], external_deps = [ "absl/base:core_headers", + "absl/log:log", "absl/numeric:int128", "absl/strings", "absl/strings:str_format", @@ -157,6 +158,7 @@ grpc_cc_library( "absl/container:flat_hash_map", "absl/functional:any_invocable", "absl/log:check", + "absl/log:log", "absl/status", "absl/status:statusor", "absl/types:optional", diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index 08c373e425d..597fb7c0c26 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -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", diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc index eb9b0c09a2f..b2c38dba64a 100644 --- a/test/core/end2end/bad_server_response_test.cc +++ b/test/core/end2end/bad_server_response_test.cc @@ -25,6 +25,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -35,7 +36,6 @@ #include #include #include -#include #include #include @@ -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; } diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc index 055e115a286..1e3414b8875 100644 --- a/test/core/end2end/connection_refused_test.cc +++ b/test/core/end2end/connection_refused_test.cc @@ -21,6 +21,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -29,7 +30,6 @@ #include #include #include -#include #include #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); diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index c318f7fa301..c0bc5b66f97 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -29,6 +29,7 @@ #include #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 #include #include -#include #include #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(GRPC_SLICE_START_PTR(a)); const char* b_str = reinterpret_cast(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()); diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc index bf793e97bec..33ab2091c1b 100644 --- a/test/core/end2end/dualstack_socket_test.cc +++ b/test/core/end2end/dualstack_socket_test.cc @@ -21,6 +21,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include @@ -47,7 +48,6 @@ #include #include #include -#include #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); diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc index 30615b1698a..51505c91fd5 100644 --- a/test/core/end2end/end2end_tests.cc +++ b/test/core/end2end/end2end_tests.cc @@ -23,6 +23,7 @@ #include #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; diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc index be2ec412014..3eca777e098 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.cc +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc @@ -27,6 +27,7 @@ #include #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 #include #include -#include #include #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(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() diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc index cb1a2e04cb2..febdb809838 100644 --- a/test/core/end2end/fixtures/proxy.cc +++ b/test/core/end2end/fixtures/proxy.cc @@ -24,6 +24,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include @@ -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); diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index 35f52f6be3b..c3a1f0245c9 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -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", diff --git a/test/core/end2end/fuzzers/fuzzing_common.cc b/test/core/end2end/fuzzers/fuzzing_common.cc index 4a20a7870fe..2597694bf3b 100644 --- a/test/core/end2end/fuzzers/fuzzing_common.cc +++ b/test/core/end2end/fuzzers/fuzzing_common.cc @@ -24,6 +24,7 @@ #include #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; diff --git a/test/core/end2end/fuzzers/network_input.cc b/test/core/end2end/fuzzers/network_input.cc index 855d3185678..278fd0ffc69 100644 --- a/test/core/end2end/fuzzers/network_input.cc +++ b/test/core/end2end/fuzzers/network_input.cc @@ -23,6 +23,7 @@ #include #include +#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 ep = diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index 3efd3939364..edf58074223 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -27,6 +27,7 @@ #include #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 #include #include -#include #include #include @@ -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; diff --git a/test/core/end2end/grpc_core_end2end_test.bzl b/test/core/end2end/grpc_core_end2end_test.bzl index 78733efcf2b..8b75ae6aac8 100644 --- a/test/core/end2end/grpc_core_end2end_test.bzl +++ b/test/core/end2end/grpc_core_end2end_test.bzl @@ -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", diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index d24c6956235..3d1470194ec 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -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 #include #include -#include #include #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 { 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()); diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc index a297eb61a3b..1f086c3f98a 100644 --- a/test/core/end2end/invalid_call_argument_test.cc +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -24,6 +24,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include @@ -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); diff --git a/test/core/end2end/no_server_test.cc b/test/core/end2end/no_server_test.cc index dc3db4b37bf..4b14f0a1a72 100644 --- a/test/core/end2end/no_server_test.cc +++ b/test/core/end2end/no_server_test.cc @@ -21,6 +21,7 @@ #include #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 #include #include -#include #include #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 { diff --git a/test/core/end2end/tests/call_creds.cc b/test/core/end2end/tests/call_creds.cc index ce6b949085f..2b078a1152d 100644 --- a/test/core/end2end/tests/call_creds.cc +++ b/test/core/end2end/tests/call_creds.cc @@ -18,6 +18,7 @@ #include +#include "absl/log/log.h" #include "absl/types/optional.h" #include "gtest/gtest.h" @@ -25,7 +26,6 @@ #include #include #include -#include #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; } } diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc index 81cea5a5ad2..5b65e20eb57 100644 --- a/test/core/end2end/tests/disappearing_server.cc +++ b/test/core/end2end/tests/disappearing_server.cc @@ -18,10 +18,10 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include -#include #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() diff --git a/test/core/end2end/tests/filter_context.cc b/test/core/end2end/tests/filter_context.cc index 450a44053ad..7d53047f971 100644 --- a/test/core/end2end/tests/filter_context.cc +++ b/test/core/end2end/tests/filter_context.cc @@ -20,11 +20,11 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "gtest/gtest.h" #include -#include #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(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); } diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc index acf4c109089..0bc7a69e034 100644 --- a/test/core/end2end/tests/resource_quota_server.cc +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -21,13 +21,13 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" #include #include #include -#include #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) { diff --git a/test/core/end2end/tests/server_streaming.cc b/test/core/end2end/tests/server_streaming.cc index 76cd2ae7382..b6fd6f30511 100644 --- a/test/core/end2end/tests/server_streaming.cc +++ b/test/core/end2end/tests/server_streaming.cc @@ -19,10 +19,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" #include -#include #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; diff --git a/test/core/end2end/tests/simple_delayed_request.cc b/test/core/end2end/tests/simple_delayed_request.cc index e22ea978335..bbdfe4ab790 100644 --- a/test/core/end2end/tests/simple_delayed_request.cc +++ b/test/core/end2end/tests/simple_delayed_request.cc @@ -18,12 +18,12 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include #include #include -#include #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); diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 359489f6c2d..1e39734d327 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -22,13 +22,13 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/match.h" #include "absl/types/optional.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include -#include #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, diff --git a/test/core/end2end/tests/timeout_before_request_call.cc b/test/core/end2end/tests/timeout_before_request_call.cc index 5ad6a9872a1..bb61acd648e 100644 --- a/test/core/end2end/tests/timeout_before_request_call.cc +++ b/test/core/end2end/tests/timeout_before_request_call.cc @@ -16,6 +16,7 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include @@ -147,7 +148,7 @@ CORE_END2END_TEST(CoreDeadlineSingleHopTest, bool got_call = false; std::unique_ptr 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 diff --git a/test/core/gprpp/BUILD b/test/core/gprpp/BUILD index b6ca769f46d..177c5809b0c 100644 --- a/test/core/gprpp/BUILD +++ b/test/core/gprpp/BUILD @@ -60,6 +60,20 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "dump_args_test", + srcs = ["dump_args_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + uses_event_engine = False, + uses_polling = False, + deps = [ + "//src/core:dump_args", + ], +) + # TODO(hork): solidify fork support requirements for EventEngines grpc_cc_test( name = "fork_test", diff --git a/test/core/gprpp/dump_args_test.cc b/test/core/gprpp/dump_args_test.cc new file mode 100644 index 00000000000..2207d4eab62 --- /dev/null +++ b/test/core/gprpp/dump_args_test.cc @@ -0,0 +1,44 @@ +// Copyright 2024 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/core/lib/gprpp/dump_args.h" + +#include + +#include "gtest/gtest.h" + +template +std::string Stringify(const T& t) { + std::ostringstream oss; + oss << t; + return oss.str(); +} + +int add(int a, int b) { return a + b; } + +TEST(DumpArgsTest, Basic) { + int a = 1; + int b = 2; + int c = 3; + EXPECT_EQ("a = 1, b = 2, c = 3", Stringify(GRPC_DUMP_ARGS(a, b, c))); +} + +TEST(DumpArgsTest, FunctionCall) { + EXPECT_EQ("add(1, 2) = 3", Stringify(GRPC_DUMP_ARGS(add(1, 2)))); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/distrib/fix_build_deps.py b/tools/distrib/fix_build_deps.py index 03dbcc9137b..0a114910e3e 100755 --- a/tools/distrib/fix_build_deps.py +++ b/tools/distrib/fix_build_deps.py @@ -64,6 +64,7 @@ EXTERNAL_DEPS = { "absl/functional/bind_front.h": "absl/functional:bind_front", "absl/functional/function_ref.h": "absl/functional:function_ref", "absl/hash/hash.h": "absl/hash", + "absl/log/check.h": "absl/log:check", "absl/memory/memory.h": "absl/memory", "absl/meta/type_traits.h": "absl/meta:type_traits", "absl/numeric/int128.h": "absl/numeric:int128", @@ -543,9 +544,11 @@ def make_library(library): # once EventEngine lands we can clean this up deps = Choices( library, - {"//:grpc_base": ["//:grpc", "//:grpc_unsecure"]} - if library.startswith("//test/") - else {}, + ( + {"//:grpc_base": ["//:grpc", "//:grpc_unsecure"]} + if library.startswith("//test/") + else {} + ), ) external_deps = Choices(None, {}) for hdr in hdrs: diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 61b98ca9bd1..a733817a370 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2969,6 +2969,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "dump_args_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": false + }, { "args": [], "benchmark": false,