Merge branch 'master' into transport-refs-6

pull/36635/head
Craig Tiller 6 months ago
commit 843a9f4b7e
  1. 102
      CMakeLists.txt
  2. 6
      bazel/experiments.bzl
  3. 38
      build_autogenerated.yaml
  4. 3
      src/core/channelz/channelz_registry.cc
  5. 3
      src/core/client_channel/dynamic_filters.cc
  6. 3
      src/core/client_channel/subchannel.cc
  7. 36
      src/core/ext/filters/logging/logging_filter.cc
  8. 3
      src/core/ext/gcp/metadata_query.cc
  9. 3
      src/core/ext/transport/binder/client/channel_create.cc
  10. 17
      src/core/ext/transport/binder/client/endpoint_binder_pool.cc
  11. 7
      src/core/ext/transport/binder/client/jni_utils.cc
  12. 6
      src/core/ext/transport/binder/transport/binder_transport.cc
  13. 11
      src/core/ext/transport/binder/utils/ndk_binder.cc
  14. 19
      src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
  15. 5
      src/core/ext/transport/binder/wire_format/binder_android.cc
  16. 25
      src/core/ext/transport/binder/wire_format/wire_writer.cc
  17. 27
      src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
  18. 3
      src/core/ext/transport/chttp2/client/chttp2_connector.cc
  19. 19
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  20. 14
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  21. 6
      src/core/ext/transport/chttp2/transport/hpack_parser_table.cc
  22. 10
      src/core/ext/transport/chttp2/transport/parsing.cc
  23. 11
      src/core/ext/transport/inproc/legacy_inproc_transport.cc
  24. 3
      src/core/handshaker/http_connect/http_proxy_mapper.cc
  25. 11
      src/core/lib/address_utils/parse_address.cc
  26. 3
      src/core/lib/channel/channel_stack.cc
  27. 9
      src/core/lib/compression/message_compress.cc
  28. 5
      src/core/lib/debug/trace.cc
  29. 5
      src/core/lib/event_engine/ares_resolver.cc
  30. 7
      src/core/lib/event_engine/posix_engine/posix_endpoint.cc
  31. 3
      src/core/lib/event_engine/posix_engine/posix_endpoint.h
  32. 3
      src/core/lib/event_engine/posix_engine/posix_engine.cc
  33. 5
      src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc
  34. 5
      src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc
  35. 3
      src/core/lib/event_engine/posix_engine/traced_buffer_list.cc
  36. 5
      src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
  37. 2
      src/core/lib/experiments/experiments.cc
  38. 3
      src/core/lib/experiments/experiments.h
  39. 4
      src/core/lib/experiments/rollouts.yaml
  40. 3
      src/core/lib/gprpp/posix/thd.cc
  41. 5
      src/core/lib/gprpp/windows/thd.cc
  42. 11
      src/core/lib/gprpp/work_serializer.cc
  43. 3
      src/core/lib/http/httpcli_security_connector.cc
  44. 6
      src/core/lib/iomgr/buffer_list.cc
  45. 11
      src/core/lib/iomgr/call_combiner.cc
  46. 7
      src/core/lib/iomgr/ev_poll_posix.cc
  47. 3
      src/core/lib/iomgr/ev_posix.cc
  48. 5
      src/core/lib/iomgr/event_engine_shims/endpoint.cc
  49. 4
      src/core/lib/iomgr/fork_windows.cc
  50. 6
      src/core/lib/iomgr/internal_errqueue.cc
  51. 3
      src/core/lib/iomgr/iocp_windows.cc
  52. 5
      src/core/lib/iomgr/socket_utils_common_posix.cc
  53. 3
      src/core/lib/iomgr/socket_windows.cc
  54. 3
      src/core/lib/iomgr/tcp_client_posix.cc
  55. 8
      src/core/lib/iomgr/tcp_posix.cc
  56. 3
      src/core/lib/iomgr/tcp_server_utils_posix_common.cc
  57. 3
      src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc
  58. 7
      src/core/lib/iomgr/tcp_server_windows.cc
  59. 19
      src/core/lib/iomgr/timer_manager.cc
  60. 6
      src/core/lib/promise/context.h
  61. 5
      src/core/lib/promise/map_pipe.h
  62. 23
      src/core/lib/promise/pipe.h
  63. 3
      src/core/lib/security/authorization/evaluate_args.cc
  64. 3
      src/core/lib/security/context/security_context.cc
  65. 4
      src/core/lib/security/credentials/alts/check_gcp_environment.cc
  66. 3
      src/core/lib/security/credentials/call_creds_util.cc
  67. 3
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  68. 19
      src/core/lib/security/credentials/jwt/json_token.cc
  69. 3
      src/core/lib/security/credentials/jwt/jwt_credentials.cc
  70. 15
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  71. 3
      src/core/lib/security/credentials/plugin/plugin_credentials.cc
  72. 9
      src/core/lib/security/credentials/ssl/ssl_credentials.cc
  73. 3
      src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc
  74. 9
      src/core/lib/security/credentials/tls/tls_credentials.cc
  75. 6
      src/core/lib/security/security_connector/load_system_roots_supported.cc
  76. 3
      src/core/lib/security/security_connector/ssl/ssl_security_connector.cc
  77. 15
      src/core/lib/security/security_connector/ssl_utils.cc
  78. 5
      src/core/lib/security/security_connector/tls/tls_security_connector.cc
  79. 2
      src/core/lib/surface/call.cc
  80. 7
      src/core/lib/surface/channel_init.cc
  81. 9
      src/core/lib/surface/completion_queue.cc
  82. 9
      src/core/lib/surface/init.cc
  83. 8
      src/core/lib/surface/legacy_channel.cc
  84. 5
      src/core/resolver/binder/binder_resolver.cc
  85. 3
      src/core/resolver/dns/c_ares/dns_resolver_ares.cc
  86. 3
      src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc
  87. 9
      src/core/resolver/dns/dns_resolver_plugin.cc
  88. 3
      src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc
  89. 5
      src/core/resolver/dns/native/dns_resolver.cc
  90. 3
      src/core/resolver/google_c2p/google_c2p_resolver.cc
  91. 5
      src/core/server/server.cc
  92. 3
      src/core/service_config/service_config_channel_arg_filter.cc
  93. 25
      src/core/tsi/alts/frame_protector/alts_frame_protector.cc
  94. 52
      src/core/tsi/alts/handshaker/alts_handshaker_client.cc
  95. 3
      src/core/tsi/alts/handshaker/alts_tsi_utils.cc
  96. 3
      src/core/tsi/alts/handshaker/transport_security_common_api.cc
  97. 9
      src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc
  98. 8
      src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc
  99. 7
      src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
  100. 21
      src/core/tsi/fake_transport_security.cc
  101. Some files were not shown because too many files have changed in this diff Show More

102
CMakeLists.txt generated

@ -1458,7 +1458,6 @@ if(gRPC_BUILD_TESTS)
add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_heap_test)
add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_list_test)
add_dependencies(buildtests_cxx test_core_event_engine_slice_buffer_test)
add_dependencies(buildtests_cxx test_core_gpr_time_test)
add_dependencies(buildtests_cxx test_core_gprpp_time_test)
add_dependencies(buildtests_cxx test_core_iomgr_timer_heap_test)
add_dependencies(buildtests_cxx test_core_security_credentials_test)
@ -1468,6 +1467,7 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx test_core_transport_test_suite_chaotic_good_test)
endif()
add_dependencies(buildtests_cxx test_core_util_time_test)
add_dependencies(buildtests_cxx test_cpp_client_credentials_test)
add_dependencies(buildtests_cxx test_cpp_end2end_ssl_credentials_test)
add_dependencies(buildtests_cxx test_cpp_ext_chaotic_good_test)
@ -6313,7 +6313,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(alloc_test
test/core/gpr/alloc_test.cc
test/core/util/alloc_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -11722,7 +11722,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(cpu_test
test/core/gpr/cpu_test.cc
test/core/util/cpu_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -12918,7 +12918,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(env_test
test/core/gpr/env_test.cc
test/core/util/env_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -19118,7 +19118,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(log_test
test/core/gpr/log_test.cc
test/core/util/log_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -28540,7 +28540,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(spinlock_test
test/core/gpr/spinlock_test.cc
test/core/util/spinlock_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29286,7 +29286,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(string_test
test/core/gpr/string_test.cc
test/core/util/string_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29371,7 +29371,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(sync_test
test/core/gpr/sync_test.cc
test/core/util/sync_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29998,48 +29998,6 @@ target_link_libraries(test_core_event_engine_slice_buffer_test
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_core_gpr_time_test
test/core/gpr/time_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
target_compile_definitions(test_core_gpr_time_test
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
)
endif()
endif()
target_compile_features(test_core_gpr_time_test PUBLIC cxx_std_14)
target_include_directories(test_core_gpr_time_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(test_core_gpr_time_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
@ -30387,6 +30345,48 @@ endif()
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_core_util_time_test
test/core/util/time_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
target_compile_definitions(test_core_util_time_test
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
)
endif()
endif()
target_compile_features(test_core_util_time_test PUBLIC cxx_std_14)
target_include_directories(test_core_util_time_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(test_core_util_time_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_cpp_client_credentials_test
test/cpp/client/credentials_test.cc
test/cpp/util/tls_test_utils.cc
@ -32064,7 +32064,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(useful_test
test/core/gpr/useful_test.cc
test/core/util/useful_test.cc
)
target_compile_features(useful_test PUBLIC cxx_std_14)
target_include_directories(useful_test

@ -74,6 +74,9 @@ EXPERIMENTS = {
],
},
"on": {
"cancel_ares_query_test": [
"event_engine_dns",
],
"core_end2end_test": [
"event_engine_client",
"event_engine_listener",
@ -90,6 +93,9 @@ EXPERIMENTS = {
"lb_unit_test": [
"pick_first_new",
],
"resolver_component_tests_runner_invoker": [
"event_engine_dns",
],
"xds_end2end_test": [
"pick_first_new",
],

@ -5407,7 +5407,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/alloc_test.cc
- test/core/util/alloc_test.cc
deps:
- gtest
- grpc_test_util
@ -8402,7 +8402,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/cpu_test.cc
- test/core/util/cpu_test.cc
deps:
- gtest
- grpc_test_util
@ -8995,7 +8995,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/env_test.cc
- test/core/util/env_test.cc
deps:
- gtest
- grpc_test_util
@ -12778,7 +12778,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/log_test.cc
- test/core/util/log_test.cc
deps:
- gtest
- grpc_test_util
@ -18693,7 +18693,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/spinlock_test.cc
- test/core/util/spinlock_test.cc
deps:
- gtest
- grpc_test_util
@ -18988,7 +18988,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/string_test.cc
- test/core/util/string_test.cc
deps:
- gtest
- grpc_test_util
@ -19017,7 +19017,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/sync_test.cc
- test/core/util/sync_test.cc
deps:
- gtest
- grpc_test_util
@ -19345,17 +19345,6 @@ targets:
- absl/status:statusor
- absl/utility:utility
- gpr
- name: test_core_gpr_time_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/gpr/time_test.cc
deps:
- gtest
- grpc_test_util
uses_polling: false
- name: test_core_gprpp_time_test
gtest: true
build: test
@ -19527,6 +19516,17 @@ targets:
- linux
- posix
uses_polling: false
- name: test_core_util_time_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/util/time_test.cc
deps:
- gtest
- grpc_test_util
uses_polling: false
- name: test_cpp_client_credentials_test
gtest: true
build: test
@ -20266,7 +20266,7 @@ targets:
headers:
- src/core/util/useful.h
src:
- test/core/gpr/useful_test.cc
- test/core/util/useful_test.cc
deps:
- gtest
uses_polling: false

@ -25,6 +25,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/grpc.h>
#include <grpc/support/json.h>
@ -171,7 +172,7 @@ void ChannelzRegistry::InternalLogAllEntities() {
}
for (size_t i = 0; i < nodes.size(); ++i) {
std::string json = nodes[i]->RenderJsonString();
gpr_log(GPR_INFO, "%s", json.c_str());
LOG(INFO) << json;
}
}

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include <grpc/support/log.h>
@ -68,7 +69,7 @@ DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(channel_stack_->channel_stack_.get(), 1,
Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
LOG(ERROR) << "error: " << StatusToString(*error);
return;
}
grpc_call_stack_set_pollset_or_pollset_set(call_stack, args.pollent);

@ -27,6 +27,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/cord.h"
#include "absl/strings/str_cat.h"
@ -196,7 +197,7 @@ SubchannelCall::SubchannelCall(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(connected_subchannel_->channel_stack(), 1,
SubchannelCall::Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
LOG(ERROR) << "error: " << StatusToString(*error);
return;
}
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);

@ -31,6 +31,7 @@
#include <utility>
#include <vector>
#include "absl/log/log.h"
#include "absl/numeric/int128.h"
#include "absl/random/random.h"
#include "absl/random/uniform_int_distribution.h"
@ -160,7 +161,7 @@ LoggingSink::Entry::Address PeerStringToAddress(const Slice& peer_string) {
LoggingSink::Entry::Address address;
absl::StatusOr<URI> uri = URI::Parse(peer_string.as_string_view());
if (!uri.ok()) {
gpr_log(GPR_DEBUG, "peer_string is in invalid format and cannot be logged");
VLOG(2) << "peer_string is in invalid format and cannot be logged";
return address;
}
@ -368,13 +369,14 @@ void ClientLoggingFilter::Call::OnClientInitialMetadata(
return;
}
call_data_->LogClientHeader(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>(), md);
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(), md);
}
void ClientLoggingFilter::Call::OnServerInitialMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
call_data_->LogServerHeader(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>(), &md);
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ClientLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
@ -382,32 +384,33 @@ void ClientLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
if (md.get(GrpcCallWasCancelled()).value_or(false) &&
md.get(GrpcStatusMetadata()) == GRPC_STATUS_CANCELLED) {
call_data_->LogCancel(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>());
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>());
return;
}
call_data_->LogServerTrailer(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>(), &md);
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ClientLoggingFilter::Call::OnClientToServerMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogClientMessage(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>(),
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
void ClientLoggingFilter::Call::OnClientToServerHalfClose() {
if (!call_data_.has_value()) return;
call_data_->LogClientHalfClose(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>());
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>());
}
void ClientLoggingFilter::Call::OnServerToClientMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogServerMessage(
/*is_client=*/true, GetContext<CallTracerAnnotationInterface>(),
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
@ -431,13 +434,15 @@ void ServerLoggingFilter::Call::OnClientInitialMetadata(ClientMetadata& md) {
return;
}
call_data_->LogClientHeader(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>(), md);
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
md);
}
void ServerLoggingFilter::Call::OnServerInitialMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
call_data_->LogServerHeader(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>(), &md);
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ServerLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
@ -445,32 +450,33 @@ void ServerLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
if (md.get(GrpcCallWasCancelled()).value_or(false) &&
md.get(GrpcStatusMetadata()) == GRPC_STATUS_CANCELLED) {
call_data_->LogCancel(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>());
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>());
return;
}
call_data_->LogServerTrailer(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>(), &md);
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ServerLoggingFilter::Call::OnClientToServerMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogClientMessage(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>(),
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
void ServerLoggingFilter::Call::OnClientToServerHalfClose() {
if (!call_data_.has_value()) return;
call_data_->LogClientHalfClose(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>());
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>());
}
void ServerLoggingFilter::Call::OnServerToClientMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogServerMessage(
/*is_client=*/false, GetContext<CallTracerAnnotationInterface>(),
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -120,7 +121,7 @@ void MetadataQuery::OnDone(void* arg, grpc_error_handle error) {
absl::StrFormat("MetadataServer Could not parse zone: %s",
std::string(body).c_str()));
if (GRPC_TRACE_FLAG_ENABLED(grpc_metadata_query_trace)) {
gpr_log(GPR_INFO, "%s", result.status().ToString().c_str());
LOG(INFO) << result.status().ToString();
}
} else {
result = std::string(body.substr(pos + 1));

@ -35,6 +35,7 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/substitute.h"
#include "absl/time/clock.h"
@ -111,7 +112,7 @@ std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
std::string connection_id =
grpc_binder::GetConnectionIdGenerator()->Generate(uri);
gpr_log(GPR_ERROR, "connection id is %s", connection_id.c_str());
LOG(ERROR) << "connection id is " << connection_id;
// After invoking this Java method, Java code will put endpoint binder into
// `EndpointBinderPool` after the connection succeeds

@ -15,6 +15,7 @@
#include "src/core/ext/transport/binder/client/endpoint_binder_pool.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/port_platform.h>
@ -36,11 +37,11 @@ Java_io_grpc_binder_cpp_GrpcBinderConnection_notifyConnected__Ljava_lang_String_
JNIEnv* jni_env, jobject, jstring conn_id_jstring, jobject ibinder) {
jboolean isCopy;
const char* conn_id = jni_env->GetStringUTFChars(conn_id_jstring, &isCopy);
gpr_log(GPR_INFO, "%s invoked with conn_id = %s", __func__, conn_id);
LOG(INFO) << __func__ << " invoked with conn_id = " << conn_id;
CHECK_NE(ibinder, nullptr);
grpc_binder::ndk_util::SpAIBinder aibinder =
grpc_binder::FromJavaBinder(jni_env, ibinder);
gpr_log(GPR_INFO, "%s got aibinder = %p", __func__, aibinder.get());
LOG(INFO) << __func__ << " got aibinder = " << aibinder.get();
auto b = std::make_unique<grpc_binder::BinderAndroid>(aibinder);
CHECK(b != nullptr);
grpc_binder::GetEndpointBinderPool()->AddEndpointBinder(conn_id,
@ -58,7 +59,7 @@ namespace grpc_binder {
void EndpointBinderPool::GetEndpointBinder(
std::string conn_id,
std::function<void(std::unique_ptr<grpc_binder::Binder>)> cb) {
gpr_log(GPR_INFO, "EndpointBinder requested. conn_id = %s", conn_id.c_str());
LOG(INFO) << "EndpointBinder requested. conn_id = " << conn_id;
std::unique_ptr<grpc_binder::Binder> b;
{
grpc_core::MutexLock l(&m_);
@ -68,9 +69,8 @@ void EndpointBinderPool::GetEndpointBinder(
CHECK(b != nullptr);
} else {
if (pending_requests_.count(conn_id) != 0) {
gpr_log(GPR_ERROR,
"Duplicate GetEndpointBinder requested. conn_id = %s",
conn_id.c_str());
LOG(ERROR) << "Duplicate GetEndpointBinder requested. conn_id = "
<< conn_id;
return;
}
pending_requests_[conn_id] = std::move(cb);
@ -83,15 +83,14 @@ void EndpointBinderPool::GetEndpointBinder(
void EndpointBinderPool::AddEndpointBinder(
std::string conn_id, std::unique_ptr<grpc_binder::Binder> b) {
gpr_log(GPR_INFO, "EndpointBinder added. conn_id = %s", conn_id.c_str());
LOG(INFO) << "EndpointBinder added. conn_id = " << conn_id;
CHECK(b != nullptr);
// cb will be set in the following block if there is a pending callback
std::function<void(std::unique_ptr<grpc_binder::Binder>)> cb = nullptr;
{
grpc_core::MutexLock l(&m_);
if (binder_map_.count(conn_id) != 0) {
gpr_log(GPR_ERROR, "EndpointBinder already in the pool. conn_id = %s",
conn_id.c_str());
LOG(ERROR) << "EndpointBinder already in the pool. conn_id = " << conn_id;
return;
}
if (pending_requests_.count(conn_id)) {

@ -15,6 +15,7 @@
#include "src/core/ext/transport/binder/client/jni_utils.h"
#include "absl/log/check.h"
#include "absl/log/log.h" // IWYU pragma: keep
#include <grpc/support/port_platform.h>
@ -83,7 +84,7 @@ void TryEstablishConnection(JNIEnv* env, jobject application,
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
env->CallStaticVoidMethod(cl, mid, application,
@ -107,7 +108,7 @@ void TryEstablishConnectionWithUri(JNIEnv* env, jobject application,
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
env->CallStaticVoidMethod(cl, mid, application,
@ -126,7 +127,7 @@ bool IsSignatureMatch(JNIEnv* env, jobject context, int uid1, int uid2) {
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
jboolean result = env->CallStaticBooleanMethod(cl, mid, context, uid1, uid2);

@ -297,7 +297,7 @@ static void recv_trailing_metadata_locked(void* arg,
// Append status to metadata
// TODO(b/192208695): See if we can avoid to manually put status
// code into the header
gpr_log(GPR_INFO, "status = %d", args->status);
LOG(INFO) << "status = " << args->status;
stream->recv_trailing_metadata->Set(
grpc_core::GrpcStatusMetadata(),
static_cast<grpc_status_code>(args->status));
@ -350,7 +350,7 @@ class MetadataEncoder {
}
void Encode(grpc_core::GrpcStatusMetadata, grpc_status_code status) {
gpr_log(GPR_INFO, "send trailing metadata status = %d", status);
LOG(INFO) << "send trailing metadata status = " << status;
tx_->SetStatus(status);
}
@ -395,7 +395,7 @@ static void perform_stream_op_locked(void* stream_op,
CHECK(!op->send_initial_metadata && !op->send_message &&
!op->send_trailing_metadata && !op->recv_initial_metadata &&
!op->recv_message && !op->recv_trailing_metadata);
gpr_log(GPR_INFO, "cancel_stream is_client = %d", stream->is_client);
LOG(INFO) << "cancel_stream is_client = " << stream->is_client;
if (!stream->is_client) {
// Send trailing metadata to inform the other end about the cancellation,
// regardless if we'd already done that or not.

@ -23,6 +23,7 @@
#include <dlfcn.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
@ -60,10 +61,10 @@ void SetJvm(JNIEnv* env) {
JavaVM* jvm = nullptr;
jint error = env->GetJavaVM(&jvm);
if (error != JNI_OK) {
gpr_log(GPR_ERROR, "Failed to get JVM");
LOG(ERROR) << "Failed to get JVM";
}
g_jvm = jvm;
gpr_log(GPR_INFO, "JVM cached");
LOG(INFO) << "JVM cached";
}
// `SetJvm` need to be called in the process before `AttachJvm`. This is always
@ -77,14 +78,14 @@ bool AttachJvm() {
// Note: The following code would be run at most once per thread.
grpc_core::MutexLock lock(&g_jvm_mu);
if (g_jvm == nullptr) {
gpr_log(GPR_ERROR, "JVM not cached yet");
LOG(ERROR) << "JVM not cached yet";
return false;
}
JNIEnv* env_unused;
// Note that attach a thread that is already attached is a no-op, so it is
// fine to call this again if the thread has already been attached by other.
g_jvm->AttachCurrentThread(&env_unused, /* thr_args= */ nullptr);
gpr_log(GPR_INFO, "JVM attached successfully");
LOG(INFO) << "JVM attached successfully";
g_is_jvm_attached = true;
return true;
}
@ -151,7 +152,7 @@ binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code,
AParcel** in, AParcel** out,
binder_flags_t flags) {
if (!AttachJvm()) {
gpr_log(GPR_ERROR, "failed to attach JVM. AIBinder_transact might fail.");
LOG(ERROR) << "failed to attach JVM. AIBinder_transact might fail.";
}
FORWARD(AIBinder_transact)(binder, code, in, out, flags);
}

@ -23,8 +23,7 @@
#include <utility>
#include "absl/log/check.h"
#include <grpc/support/log.h>
#include "absl/log/log.h"
#include "src/core/lib/gprpp/crash.h"
@ -36,7 +35,7 @@ const absl::string_view
void TransportStreamReceiverImpl::RegisterRecvInitialMetadata(
StreamIdentifier id, InitialMetadataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
absl::StatusOr<Metadata> initial_metadata{};
{
grpc_core::MutexLock l(&m_);
@ -64,7 +63,7 @@ void TransportStreamReceiverImpl::RegisterRecvInitialMetadata(
void TransportStreamReceiverImpl::RegisterRecvMessage(
StreamIdentifier id, MessageDataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
absl::StatusOr<std::string> message{};
{
grpc_core::MutexLock l(&m_);
@ -98,7 +97,7 @@ void TransportStreamReceiverImpl::RegisterRecvMessage(
void TransportStreamReceiverImpl::RegisterRecvTrailingMetadata(
StreamIdentifier id, TrailingMetadataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
std::pair<absl::StatusOr<Metadata>, int> trailing_metadata{};
{
grpc_core::MutexLock l(&m_);
@ -122,7 +121,7 @@ void TransportStreamReceiverImpl::RegisterRecvTrailingMetadata(
void TransportStreamReceiverImpl::NotifyRecvInitialMetadata(
StreamIdentifier id, absl::StatusOr<Metadata> initial_metadata) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
if (!is_client_ && accept_stream_callback_ && initial_metadata.ok()) {
accept_stream_callback_();
}
@ -143,7 +142,7 @@ void TransportStreamReceiverImpl::NotifyRecvInitialMetadata(
void TransportStreamReceiverImpl::NotifyRecvMessage(
StreamIdentifier id, absl::StatusOr<std::string> message) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
MessageDataCallbackType cb;
{
grpc_core::MutexLock l(&m_);
@ -166,7 +165,7 @@ void TransportStreamReceiverImpl::NotifyRecvTrailingMetadata(
// assumes in-order commitments of transactions and that trailing metadata is
// parsed after message data, we can safely cancel all upcoming callbacks of
// recv_message.
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
OnRecvTrailingMetadata(id);
TrailingMetadataCallbackType cb;
{
@ -233,7 +232,7 @@ void TransportStreamReceiverImpl::CancelTrailingMetadataCallback(
}
void TransportStreamReceiverImpl::OnRecvTrailingMetadata(StreamIdentifier id) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
m_.Lock();
trailing_metadata_recvd_.insert(id);
m_.Unlock();
@ -245,7 +244,7 @@ void TransportStreamReceiverImpl::OnRecvTrailingMetadata(StreamIdentifier id) {
}
void TransportStreamReceiverImpl::CancelStream(StreamIdentifier id) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
CancelInitialMetadataCallback(id, absl::CancelledError("Stream cancelled"));
CancelMessageCallback(id, absl::CancelledError("Stream cancelled"));
CancelTrailingMetadataCallback(id, absl::CancelledError("Stream cancelled"));

@ -21,6 +21,7 @@
#include <map>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
@ -65,7 +66,7 @@ ndk_util::binder_status_t f_onTransact(ndk_util::AIBinder* binder,
const ndk_util::AParcel* in,
ndk_util::AParcel* /*out*/) {
gpr_log(GPR_INFO, __func__);
gpr_log(GPR_INFO, "tx code = %u", code);
LOG(INFO) << "tx code = " << code;
auto* user_data =
static_cast<BinderUserData*>(ndk_util::AIBinder_getUserData(binder));
@ -79,7 +80,7 @@ ndk_util::binder_status_t f_onTransact(ndk_util::AIBinder* binder,
if (status.ok()) {
return ndk_util::STATUS_OK;
} else {
gpr_log(GPR_ERROR, "Callback failed: %s", status.ToString().c_str());
LOG(ERROR) << "Callback failed: " << status.ToString();
return ndk_util::STATUS_UNKNOWN_ERROR;
}
}

@ -22,6 +22,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/types/variant.h"
#include <grpc/support/log.h>
@ -78,7 +79,7 @@ absl::Status WriteTrailingMetadata(const Transaction& tx,
} else {
// client suffix currently is always empty according to the wireformat
if (!tx.GetSuffixMetadata().empty()) {
gpr_log(GPR_ERROR, "Got non-empty suffix metadata from client.");
LOG(ERROR) << "Got non-empty suffix metadata from client.";
}
}
return absl::OkStatus();
@ -218,8 +219,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
return absl::OkStatus();
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
delete args;
return;
@ -242,8 +242,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
if (CanBeSentInOneTransaction(*stream_tx->tx.get())) { // NOLINT
absl::Status result = RpcCallFastPath(std::move(stream_tx->tx));
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to handle non-chunked RPC call %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to handle non-chunked RPC call " << result;
}
delete args;
return;
@ -256,8 +255,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
return RunStreamTx(stream_tx, parcel, &is_last_chunk);
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
if (!is_last_chunk) {
{
@ -290,7 +288,7 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
// Ensure combiner will be run if this is not called from top-level gRPC API
// entrypoint.
grpc_core::ExecCtx exec_ctx;
gpr_log(GPR_INFO, "Ack %" PRId64 " bytes received", num_bytes);
LOG(INFO) << "Ack " << num_bytes << " bytes received";
if (is_transacting_) {
// This can happen because NDK might call our registered callback function
// in the same thread while we are telling it to send a transaction
@ -298,10 +296,8 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
// the same thread or the other thread. We are currently in the call stack
// of other transaction, Liveness of ACK is still guaranteed even if this is
// a race with another thread.
gpr_log(
GPR_INFO,
"Scheduling ACK transaction instead of directly execute it to avoid "
"deadlock.");
LOG(INFO) << "Scheduling ACK transaction instead of directly execute it to "
"avoid deadlock.";
auto args = new RunScheduledTxArgs();
args->writer = this;
args->tx = RunScheduledTxArgs::AckTx();
@ -318,8 +314,7 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
return absl::OkStatus();
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
return result;
}
@ -328,7 +323,7 @@ void WireWriterImpl::OnAckReceived(int64_t num_bytes) {
// Ensure combiner will be run if this is not called from top-level gRPC API
// entrypoint.
grpc_core::ExecCtx exec_ctx;
gpr_log(GPR_INFO, "OnAckReceived %" PRId64, num_bytes);
LOG(INFO) << "OnAckReceived " << num_bytes;
// Do not try to obtain `write_mu_` in this function. NDKBinder might invoke
// the callback to notify us about new incoming binder transaction when we are
// sending transaction. i.e. `write_mu_` might have already been acquired by

@ -22,6 +22,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -99,8 +100,8 @@ absl::StatusOr<int> ChaoticGoodServerListener::Bind(
grpc_event_engine::experimental::EventEngine::ResolvedAddress addr) {
if (grpc_chaotic_good_trace.enabled()) {
auto str = grpc_event_engine::experimental::ResolvedAddressToString(addr);
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Listen on %s",
str.ok() ? str->c_str() : str.status().ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: Listen on "
<< (str.ok() ? str->c_str() : str.status().ToString());
}
EventEngine::Listener::AcceptCallback accept_cb =
[self = RefAsSubclass<ChaoticGoodServerListener>()](
@ -123,8 +124,7 @@ absl::StatusOr<int> ChaoticGoodServerListener::Bind(
grpc_event_engine::experimental::ChannelArgsEndpointConfig(args_),
std::make_unique<MemoryQuota>("chaotic_good_server_listener"));
if (!ee_listener.ok()) {
gpr_log(GPR_ERROR, "Bind failed: %s",
ee_listener.status().ToString().c_str());
LOG(ERROR) << "Bind failed: " << ee_listener.status().ToString();
return ee_listener.status();
}
ee_listener_ = std::move(ee_listener.value());
@ -139,9 +139,9 @@ absl::Status ChaoticGoodServerListener::StartListening() {
CHECK(ee_listener_ != nullptr);
auto status = ee_listener_->Start();
if (!status.ok()) {
gpr_log(GPR_ERROR, "Start listening failed: %s", status.ToString().c_str());
LOG(ERROR) << "Start listening failed: " << status.ToString();
} else if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Started listening");
LOG(INFO) << "CHAOTIC_GOOD: Started listening";
}
return status;
}
@ -161,7 +161,7 @@ ChaoticGoodServerListener::ActiveConnection::~ActiveConnection() {
void ChaoticGoodServerListener::ActiveConnection::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "ActiveConnection::Orphan() %p", this);
LOG(INFO) << "ActiveConnection::Orphan() " << this;
}
if (handshaking_state_ != nullptr) {
handshaking_state_->Shutdown();
@ -193,8 +193,7 @@ void ChaoticGoodServerListener::ActiveConnection::NewConnectionID() {
void ChaoticGoodServerListener::ActiveConnection::Done(
absl::optional<absl::string_view> error) {
if (error.has_value()) {
gpr_log(GPR_ERROR, "ActiveConnection::Done:%p %s", this,
std::string(*error).c_str());
LOG(ERROR) << "ActiveConnection::Done:" << this << " " << *error;
}
// Can easily be holding various locks here: bounce through EE to ensure no
// deadlocks.
@ -459,7 +458,7 @@ Timestamp ChaoticGoodServerListener::ActiveConnection::HandshakingState::
void ChaoticGoodServerListener::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "ChaoticGoodServerListener::Orphan()");
LOG(INFO) << "ChaoticGoodServerListener::Orphan()";
}
{
absl::flat_hash_set<OrphanablePtr<ActiveConnection>> connection_list;
@ -481,8 +480,8 @@ int grpc_server_add_chaotic_good_port(grpc_server* server, const char* addr) {
const auto resolved_or = grpc_core::GetDNSResolver()->LookupHostnameBlocking(
parsed_addr, absl::StrCat(0xd20));
if (!resolved_or.ok()) {
gpr_log(GPR_ERROR, "Failed to resolve %s: %s", addr,
resolved_or.status().ToString().c_str());
LOG(ERROR) << "Failed to resolve " << addr << ": "
<< resolved_or.status().ToString();
return 0;
}
int port_num = 0;
@ -497,8 +496,8 @@ int grpc_server_add_chaotic_good_port(grpc_server* server, const char* addr) {
->c_str());
auto bind_result = listener->Bind(ee_addr);
if (!bind_result.ok()) {
gpr_log(GPR_ERROR, "Failed to bind to %s: %s", addr,
bind_result.status().ToString().c_str());
LOG(ERROR) << "Failed to bind to " << addr << ": "
<< bind_result.status().ToString();
return 0;
}
if (port_num == 0) {

@ -25,6 +25,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -311,7 +312,7 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
absl::StatusOr<OrphanablePtr<Channel>> CreateChannel(const char* target,
const ChannelArgs& args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
LOG(ERROR) << "cannot create channel with NULL target name";
return absl::InvalidArgumentError("channel target is NULL");
}
return ChannelCreate(target, args, GRPC_CLIENT_CHANNEL, nullptr);

@ -30,6 +30,7 @@
#include "absl/base/thread_annotations.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"
@ -45,7 +46,6 @@
#include <grpc/passive_listener.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/channelz/channelz.h"
@ -326,8 +326,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::UpdateConnectionManager(
grpc_error_handle error = grpc_tcp_server_add_port(
listener_->tcp_server_, &listener_->resolved_address_, &port_temp);
if (!error.ok()) {
gpr_log(GPR_ERROR, "Error adding port to server: %s",
StatusToString(error).c_str());
LOG(ERROR) << "Error adding port to server: " << StatusToString(error);
// TODO(yashykt): We wouldn't need to assert here if we bound to the
// port earlier during AddPort.
CHECK(0);
@ -535,8 +534,8 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
});
} else {
// Failed to create channel from transport. Clean up.
gpr_log(GPR_ERROR, "Failed to create channel: %s",
StatusToString(channel_init_err).c_str());
LOG(ERROR) << "Failed to create channel: "
<< StatusToString(channel_init_err);
transport->Orphan();
grpc_slice_buffer_destroy(args->read_buffer);
gpr_free(args->read_buffer);
@ -1038,7 +1037,7 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
resolved_or->size() - error_list.size(), resolved_or->size());
error = GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(),
error_list.size());
gpr_log(GPR_INFO, "WARNING: %s", StatusToString(error).c_str());
LOG(INFO) << "WARNING: " << StatusToString(error);
// we managed to bind some addresses: continue without error
}
return absl::OkStatus();
@ -1158,7 +1157,7 @@ int grpc_server_add_http2_port(grpc_server* server, const char* addr,
done:
sc.reset(DEBUG_LOCATION, "server");
if (!err.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(err).c_str());
LOG(ERROR) << grpc_core::StatusToString(err);
}
return port_num;
}
@ -1169,7 +1168,7 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
// For now, we only support insecure server credentials
if (creds == nullptr ||
creds->type() != grpc_core::InsecureServerCredentials::Type()) {
gpr_log(GPR_ERROR, "Failed to create channel due to invalid creds");
LOG(ERROR) << "Failed to create channel due to invalid creds";
return;
}
grpc_core::ExecCtx exec_ctx;
@ -1194,8 +1193,8 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
}
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
} else {
gpr_log(GPR_ERROR, "Failed to create channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create channel: "
<< grpc_core::StatusToString(error);
transport->Orphan();
}
}

@ -803,8 +803,8 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
if (server_data) {
id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG, "HTTP:%p/%p creating accept stream %d [from %p]", t,
this, id, server_data);
VLOG(2) << "HTTP:" << t << "/" << this << " creating accept stream " << id
<< " [from " << server_data << "]";
}
*t->accepting_stream = this;
t->stream_map.emplace(id, this);
@ -1037,8 +1037,8 @@ static void write_action(grpc_chttp2_transport* t) {
max_frame_size = INT_MAX;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
gpr_log(GPR_INFO, "%s[%p]: Write %" PRIdPTR " bytes",
t->is_client ? "CLIENT" : "SERVER", t, t->outbuf.Length());
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t << "]: Write "
<< t->outbuf.Length() << " bytes";
}
t->write_size_policy.BeginWrite(t->outbuf.Length());
grpc_endpoint_write(t->ep, t->outbuf.c_slice_buffer(),
@ -1051,8 +1051,8 @@ static void write_action_end(grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
grpc_error_handle error) {
auto* tp = t.get();
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
gpr_log(GPR_INFO, "%s[%p]: Finish write",
t->is_client ? "CLIENT" : "SERVER", t.get());
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t.get()
<< "]: Finish write";
}
tp->combiner->Run(grpc_core::InitTransportClosure<write_action_end_locked>(
std::move(t), &tp->write_action_end_locked),
@ -1329,7 +1329,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
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) {
gpr_log(GPR_INFO, "%s", absl::StrCat(prefix, key, ": ", value).c_str());
LOG(INFO) << absl::StrCat(prefix, key, ": ", value);
});
}

@ -26,11 +26,11 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
@ -100,7 +100,7 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
return;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "Update hpack parser max size to %d", max_bytes);
LOG(INFO) << "Update hpack parser max size to " << max_bytes;
}
while (mem_used_ > max_bytes) {
EvictOne();
@ -112,7 +112,7 @@ bool HPackTable::SetCurrentTableSize(uint32_t bytes) {
if (current_table_bytes_ == bytes) return true;
if (bytes > max_bytes_) return false;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "Update hpack parser table size to %d", bytes);
LOG(INFO) << "Update hpack parser table size to " << bytes;
}
while (mem_used_ > bytes) {
EvictOne();

@ -29,6 +29,7 @@
#include "absl/base/attributes.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
@ -769,7 +770,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
frame_type = HPackParser::LogInfo::kTrailers;
break;
case 2:
gpr_log(GPR_ERROR, "too many header frames received");
LOG(ERROR) << "too many header frames received";
return init_header_skip_frame_parser(t, priority_type, is_eoh);
}
if (frame_type == HPackParser::LogInfo::kTrailers && !t->header_eof) {
@ -889,10 +890,9 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
int is_last) {
grpc_chttp2_stream* s = t->incoming_stream;
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG,
"INCOMING[%p;%p]: Parse %" PRIdPTR "b %sframe fragment with %s", t,
s, GRPC_SLICE_LENGTH(slice), is_last ? "last " : "",
t->parser.name);
VLOG(2) << "INCOMING[" << t << ";" << s << "]: Parse "
<< GRPC_SLICE_LENGTH(slice) << "b " << (is_last ? "last " : "")
<< "frame fragment with " << t->parser.name;
}
grpc_error_handle err =
t->parser.parser(t->parser.user_data, t, s, slice, is_last);

@ -28,6 +28,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -319,7 +320,7 @@ void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
std::string prefix = absl::StrCat(
"INPROC:", is_initial ? "HDR:" : "TRL:", is_client ? "CLI:" : "SVR:");
md_batch->Log([&prefix](absl::string_view key, absl::string_view value) {
gpr_log(GPR_INFO, "%s", absl::StrCat(prefix, key, ": ", value).c_str());
LOG(INFO) << absl::StrCat(prefix, key, ": ", value);
});
}
@ -1268,8 +1269,8 @@ grpc_channel* grpc_legacy_inproc_channel_create(grpc_server* server,
"inproc", client_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport);
if (!new_channel.ok()) {
CHECK(!channel);
gpr_log(GPR_ERROR, "Failed to create client channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create client channel: "
<< grpc_core::StatusToString(error);
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,
@ -1286,8 +1287,8 @@ grpc_channel* grpc_legacy_inproc_channel_create(grpc_server* server,
}
} else {
CHECK(!channel);
gpr_log(GPR_ERROR, "Failed to create server channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create server channel: "
<< grpc_core::StatusToString(error);
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,

@ -26,6 +26,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
@ -150,7 +151,7 @@ absl::optional<std::string> GetHttpProxyServer(
// User cred found
*user_cred = authority_strs[0];
proxy_name = authority_strs[1];
gpr_log(GPR_DEBUG, "userinfo found in proxy URI");
VLOG(2) << "userinfo found in proxy URI";
} else {
// Bad authority
proxy_name = absl::nullopt;

@ -19,6 +19,7 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/port_platform.h>
@ -70,7 +71,7 @@ bool grpc_parse_unix(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -86,7 +87,7 @@ bool grpc_parse_unix_abstract(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixAbstractSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -170,7 +171,7 @@ bool grpc_parse_vsock(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::VSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -238,7 +239,7 @@ bool grpc_parse_ipv4_hostport(absl::string_view hostport,
}
// Parse port.
if (port.empty()) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv4 scheme");
if (log_errors) LOG(ERROR) << "no port given for ipv4 scheme";
goto done;
}
int port_num;
@ -333,7 +334,7 @@ bool grpc_parse_ipv6_hostport(absl::string_view hostport,
}
// Parse port.
if (port.empty()) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv6 scheme");
if (log_errors) LOG(ERROR) << "no port given for ipv6 scheme";
goto done;
}
int port_num;

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -121,7 +122,7 @@ grpc_error_handle grpc_channel_stack_init(
const grpc_core::ChannelArgs& channel_args, const char* name,
grpc_channel_stack* stack) {
if (grpc_trace_channel_stack.enabled()) {
gpr_log(GPR_INFO, "CHANNEL_STACK: init %s", name);
LOG(INFO) << "CHANNEL_STACK: init " << name;
for (size_t i = 0; i < filter_count; i++) {
gpr_log(GPR_INFO, "CHANNEL_STACK: filter %s%s", filters[i]->name,
filters[i]->make_call_promise ? " [promise-capable]" : "");

@ -24,6 +24,7 @@
#include <zlib.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
@ -67,12 +68,12 @@ static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
}
} while (zs->avail_out == 0);
if (zs->avail_in) {
gpr_log(GPR_INFO, "zlib: not all input consumed");
LOG(INFO) << "zlib: not all input consumed";
goto error;
}
}
if (r != Z_STREAM_END) {
gpr_log(GPR_INFO, "zlib: Data error");
LOG(INFO) << "zlib: Data error";
goto error;
}
@ -165,7 +166,7 @@ static int compress_inner(grpc_compression_algorithm algorithm,
case GRPC_COMPRESS_ALGORITHMS_COUNT:
break;
}
gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm);
LOG(ERROR) << "invalid compression algorithm " << algorithm;
return 0;
}
@ -190,6 +191,6 @@ int grpc_msg_decompress(grpc_compression_algorithm algorithm,
case GRPC_COMPRESS_ALGORITHMS_COUNT:
break;
}
gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm);
LOG(ERROR) << "invalid compression algorithm " << algorithm;
return 0;
}

@ -22,6 +22,7 @@
#include <type_traits>
#include <utility>
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
@ -75,9 +76,9 @@ void TraceFlagList::Add(TraceFlag* flag) {
}
void TraceFlagList::LogAllTracers() {
gpr_log(GPR_DEBUG, "available tracers:");
VLOG(2) << "available tracers:";
for (TraceFlag* t = root_tracer_; t != nullptr; t = t->next_tracer_) {
gpr_log(GPR_DEBUG, "\t%s", t->name_);
VLOG(2) << "\t" << t->name_;
}
}

@ -53,6 +53,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/hash/hash.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
@ -200,7 +201,7 @@ AresResolver::CreateAresResolver(
ares_channel channel;
int status = ares_init_options(&channel, &opts, ARES_OPT_FLAGS);
if (status != ARES_SUCCESS) {
gpr_log(GPR_ERROR, "ares_init_options failed, status: %d", status);
LOG(ERROR) << "ares_init_options failed, status: " << status;
return AresStatusToAbslStatus(
status,
absl::StrCat("Failed to init c-ares channel: ", ares_strerror(status)));
@ -769,7 +770,7 @@ void AresResolver::OnTXTDoneLocked(void* arg, int status, int /*timeouts*/,
result.size());
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_ares_resolver)) {
for (const auto& record : result) {
gpr_log(GPR_INFO, "%s", record.c_str());
LOG(INFO) << record;
}
}
// Clean up.

@ -27,6 +27,7 @@
#include "absl/functional/any_invocable.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"
@ -718,7 +719,7 @@ bool PosixEndpointImpl::ProcessErrors() {
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) {
@ -813,7 +814,7 @@ struct cmsghdr* PosixEndpointImpl::ProcessTimestamp(msghdr* msg,
auto serr = reinterpret_cast<struct sock_extended_err*>(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;
}
traced_buffers_.ProcessTimestamp(serr, opt_stats, tss);
@ -1303,7 +1304,7 @@ PosixEndpointImpl::PosixEndpointImpl(EventHandle* handle,
if (setsockopt(fd_, SOL_SOCKET, SO_ZEROCOPY, &enable, sizeof(enable)) !=
0) {
zerocopy_enabled = false;
gpr_log(GPR_ERROR, "Failed to set zerocopy options on the socket.");
LOG(ERROR) << "Failed to set zerocopy options on the socket.";
}
}

@ -30,6 +30,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/hash/hash.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -183,7 +184,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;
enabled_ = false;
} else {

@ -26,6 +26,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
@ -231,7 +232,7 @@ void AsyncConnect::OnWritable(absl::Status status)
// your program or another program on the same computer
// opened too many network connections. The "easy" fix:
// don't do that!
gpr_log(GPR_ERROR, "kernel out of buffers");
LOG(ERROR) << "kernel out of buffers";
mu_.Unlock();
fd->NotifyOnWrite(on_writable_);
// Don't run the cleanup function for this case.

@ -23,6 +23,7 @@
#include "absl/cleanup/cleanup.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_replace.h"
@ -156,7 +157,7 @@ absl::Status PrepareSocket(const PosixTcpOptions& options,
#ifdef GRPC_LINUX_ERRQUEUE
if (!socket.sock.SetSocketZeroCopy().ok()) {
// it's not fatal, so just log it.
gpr_log(GPR_DEBUG, "Node does not support SO_ZEROCOPY, continuing.");
VLOG(2) << "Node does not support SO_ZEROCOPY, continuing.";
} else {
socket.zero_copy_enabled = true;
}
@ -244,7 +245,7 @@ absl::StatusOr<int> ListenerContainerAddAllLocalAddresses(
auto result = GetUnusedPort();
GRPC_RETURN_IF_ERROR(result.status());
requested_port = *result;
gpr_log(GPR_DEBUG, "Picked unused port %d", requested_port);
VLOG(2) << "Picked unused port " << requested_port;
}
if (getifaddrs(&ifa) != 0 || ifa == nullptr) {
return absl::FailedPreconditionError(

@ -18,6 +18,7 @@
#include <limits.h>
#include "absl/cleanup/cleanup.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/types/optional.h"
@ -653,7 +654,7 @@ void PosixSocketWrapper::TrySetSocketTcpUserTimeout(
}
if (newval != timeout) {
// Do not fail on failing to set TCP_USER_TIMEOUT
gpr_log(GPR_ERROR, "Failed to set TCP_USER_TIMEOUT");
LOG(ERROR) << "Failed to set TCP_USER_TIMEOUT";
return;
}
}
@ -684,7 +685,7 @@ bool PosixSocketWrapper::IsIpv6LoopbackAvailable() {
int fd = socket(AF_INET6, SOCK_STREAM, 0);
bool loopback_available = false;
if (fd < 0) {
gpr_log(GPR_INFO, "Disabling AF_INET6 sockets because socket() failed.");
LOG(INFO) << "Disabling AF_INET6 sockets because socket() failed.";
} else {
sockaddr_in6 addr;
memset(&addr, 0, sizeof(addr));

@ -22,6 +22,7 @@
#include <utility>
#include "absl/functional/any_invocable.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -48,7 +49,7 @@ void FillGprFromTimestamp(gpr_timespec* gts, const struct timespec* ts) {
void DefaultTimestampsCallback(void* /*arg*/, Timestamps* /*ts*/,
absl::Status /*shudown_err*/) {
gpr_log(GPR_DEBUG, "Timestamps callback has not been registered");
VLOG(2) << "Timestamps callback has not been registered";
}
// The saved callback function that will be invoked when we get all the

@ -27,6 +27,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "absl/types/optional.h"
@ -267,7 +268,7 @@ void WorkStealingThreadPool::WorkStealingThreadPoolImpl::StartThread() {
}
void WorkStealingThreadPool::WorkStealingThreadPoolImpl::Quiesce() {
gpr_log(GPR_INFO, "WorkStealingThreadPoolImpl::Quiesce");
LOG(INFO) << "WorkStealingThreadPoolImpl::Quiesce";
SetShutdown(true);
// Wait until all threads have exited.
// Note that if this is a threadpool thread then we won't exit this thread
@ -319,7 +320,7 @@ bool WorkStealingThreadPool::WorkStealingThreadPoolImpl::IsQuiesced() {
}
void WorkStealingThreadPool::WorkStealingThreadPoolImpl::PrepareFork() {
gpr_log(GPR_INFO, "WorkStealingThreadPoolImpl::PrepareFork");
LOG(INFO) << "WorkStealingThreadPoolImpl::PrepareFork";
SetForking(true);
work_signal_.SignalAll();
auto threads_were_shut_down = living_thread_count_.BlockUntilThreadCount(

@ -328,7 +328,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"event_engine_client", description_event_engine_client,
additional_constraints_event_engine_client, nullptr, 0, true, true},
{"event_engine_dns", description_event_engine_dns,
additional_constraints_event_engine_dns, nullptr, 0, false, false},
additional_constraints_event_engine_dns, nullptr, 0, true, false},
{"event_engine_listener", description_event_engine_listener,
additional_constraints_event_engine_listener, nullptr, 0, true, true},
{"free_large_allocator", description_free_large_allocator,

@ -99,7 +99,8 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; }
inline bool IsClientPrivacyEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
inline bool IsEventEngineClientEnabled() { return true; }
inline bool IsEventEngineDnsEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
inline bool IsEventEngineDnsEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER
inline bool IsEventEngineListenerEnabled() { return true; }
inline bool IsFreeLargeAllocatorEnabled() { return false; }

@ -64,9 +64,7 @@
# not tested on iOS at all
ios: broken
posix: true
# TODO(yijiem): resolve when the WindowsEventEngine DNS Resolver is
# implemented
windows: broken
windows: true
- name: event_engine_listener
default:
# not tested on iOS at all

@ -33,6 +33,7 @@
#include <unistd.h>
#include "absl/log/check.h"
#include "absl/log/log.h" // IWYU pragma: keep
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@ -213,7 +214,7 @@ void Thread::Kill(gpr_thd_id tid) {
}
#else // GPR_ANDROID
void Thread::Kill(gpr_thd_id /* tid */) {
gpr_log(GPR_DEBUG, "Thread::Kill is not supported on Android.");
VLOG(2) << "Thread::Kill is not supported on Android.";
}
#endif

@ -24,6 +24,7 @@
#include <string.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -149,12 +150,12 @@ namespace grpc_core {
void Thread::Signal(gpr_thd_id /* tid */, int /* sig */) {
// TODO(hork): Implement
gpr_log(GPR_DEBUG, "Thread signals are not supported on Windows.");
VLOG(2) << "Thread signals are not supported on Windows.";
}
void Thread::Kill(gpr_thd_id /* tid */) {
// TODO(hork): Implement
gpr_log(GPR_DEBUG, "Thread::Kill is not supported on Windows.");
VLOG(2) << "Thread::Kill is not supported on Windows.";
}
Thread::Thread(const char* /* thd_name */, void (*thd_body)(void* arg),

@ -28,6 +28,7 @@
#include "absl/container/inlined_vector.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/event_engine/event_engine.h>
#include <grpc/support/log.h>
@ -151,7 +152,7 @@ void WorkSerializer::LegacyWorkSerializer::Run(std::function<void()> callback,
// We took ownership of the WorkSerializer. Invoke callback and drain queue.
SetCurrentThread();
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, " Executing immediately");
LOG(INFO) << " Executing immediately";
}
callback();
// Delete the callback while still holding the WorkSerializer, so
@ -193,7 +194,7 @@ void WorkSerializer::LegacyWorkSerializer::Orphan() {
refs_.fetch_sub(MakeRefPair(0, 1), std::memory_order_acq_rel);
if (GetOwners(prev_ref_pair) == 0 && GetSize(prev_ref_pair) == 1) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, " Destroying");
LOG(INFO) << " Destroying";
}
delete this;
}
@ -232,7 +233,7 @@ void WorkSerializer::LegacyWorkSerializer::DrainQueueOwned() {
// up orphaning the work serializer. In that case, delete the object.
if (GetSize(prev_ref_pair) == 1) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, " Queue Drained. Destroying");
LOG(INFO) << " Queue Drained. Destroying";
}
delete this;
return;
@ -252,7 +253,7 @@ void WorkSerializer::LegacyWorkSerializer::DrainQueueOwned() {
if (GetSize(expected) == 0) {
// WorkSerializer got orphaned while this was running
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, " Queue Drained. Destroying");
LOG(INFO) << " Queue Drained. Destroying";
}
delete this;
return;
@ -272,7 +273,7 @@ void WorkSerializer::LegacyWorkSerializer::DrainQueueOwned() {
// This can happen due to a race condition within the mpscq
// implementation or because of a race with Run()/Schedule().
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, " Queue returned nullptr, trying again");
LOG(INFO) << " Queue returned nullptr, trying again";
}
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {

@ -20,6 +20,7 @@
#include <string>
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -173,7 +174,7 @@ class HttpRequestSSLCredentials : public grpc_channel_credentials {
const tsi_ssl_root_certs_store* root_store =
DefaultSslRootStore::GetRootStore();
if (root_store == nullptr) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
LOG(ERROR) << "Could not get default pem root certs.";
return nullptr;
}
absl::optional<std::string> target_string =

@ -18,6 +18,8 @@
#include "src/core/lib/iomgr/buffer_list.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
@ -42,7 +44,7 @@ void FillGprFromTimestamp(gpr_timespec* gts, const struct timespec* ts) {
void DefaultTimestampsCallback(void* /*arg*/, Timestamps* /*ts*/,
absl::Status /*shudown_err*/) {
gpr_log(GPR_DEBUG, "Timestamps callback has not been registered");
VLOG(2) << "Timestamps callback has not been registered";
}
// The saved callback function that will be invoked when we get all the
@ -321,7 +323,7 @@ void grpc_tcp_set_write_timestamps_callback(
// Can't comment out the name because some compilers and formatters don't
// like the sequence */* , which would arise from */*fn*/.
(void)fn;
gpr_log(GPR_DEBUG, "Timestamps callback is not enabled for this platform");
VLOG(2) << "Timestamps callback is not enabled for this platform";
}
} // namespace grpc_core

@ -21,6 +21,7 @@
#include <inttypes.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -130,13 +131,13 @@ void CallCombiner::Start(grpc_closure* closure, grpc_error_handle error,
}
if (prev_size == 0) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " EXECUTING IMMEDIATELY");
LOG(INFO) << " EXECUTING IMMEDIATELY";
}
// Queue was empty, so execute this closure immediately.
ScheduleClosure(closure, error);
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " QUEUING");
LOG(INFO) << " QUEUING";
}
// Queue was not empty, so add closure to queue.
closure->error_data.error = internal::StatusAllocHeapPtr(error);
@ -160,7 +161,7 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
if (prev_size > 1) {
while (true) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " checking queue");
LOG(INFO) << " checking queue";
}
bool empty;
grpc_closure* closure =
@ -169,7 +170,7 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
// This can happen either due to a race condition within the mpscq
// code or because of a race with Start().
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " queue returned no result; checking again");
LOG(INFO) << " queue returned no result; checking again";
}
continue;
}
@ -184,7 +185,7 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
break;
}
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " queue empty");
LOG(INFO) << " queue empty";
}
}

@ -34,6 +34,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@ -583,7 +584,7 @@ static void fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) {
static void fd_notify_on_error(grpc_fd* /*fd*/, grpc_closure* closure) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
LOG(ERROR) << "Polling engine does not support tracking errors.";
}
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, absl::CancelledError());
}
@ -602,7 +603,7 @@ static void fd_set_writable(grpc_fd* fd) {
static void fd_set_error(grpc_fd* /*fd*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
LOG(ERROR) << "Polling engine does not support tracking errors.";
}
}
@ -1397,7 +1398,7 @@ const grpc_event_engine_vtable grpc_ev_poll_posix = {
// check_engine_available =
[](bool) {
if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping poll because of no wakeup fd.");
LOG(ERROR) << "Skipping poll because of no wakeup fd.";
return false;
}
if (!GRPC_LOG_IF_ERROR("pollset_global_init", pollset_global_init())) {

@ -25,6 +25,7 @@
#include <string.h>
#include "absl/log/log.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_split.h"
@ -109,7 +110,7 @@ static void try_engine(absl::string_view engine) {
if (g_vtables[i] != nullptr && is(engine, g_vtables[i]->name) &&
g_vtables[i]->check_engine_available(engine == g_vtables[i]->name)) {
g_event_engine = g_vtables[i];
gpr_log(GPR_DEBUG, "Using polling engine: %s", g_event_engine->name);
VLOG(2) << "Using polling engine: " << g_event_engine->name;
return;
}
}

@ -19,6 +19,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
@ -128,7 +129,7 @@ class EventEngineEndpointWrapper {
for (i = 0; i < pending_read_buffer_->count; i++) {
char* dump = grpc_dump_slice(pending_read_buffer_->slices[i],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "READ DATA: %s", dump);
VLOG(2) << "READ DATA: " << dump;
gpr_free(dump);
}
}
@ -159,7 +160,7 @@ class EventEngineEndpointWrapper {
for (i = 0; i < slices->count; i++) {
char* dump =
grpc_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "WRITE DATA: %s", dump);
VLOG(2) << "WRITE DATA: " << dump;
gpr_free(dump);
}
}

@ -22,6 +22,8 @@
#ifndef GRPC_POSIX_FORK
#include "absl/log/log.h"
#include <grpc/fork.h>
#include <grpc/support/log.h>
@ -30,7 +32,7 @@
// AROUND VERY SPECIFIC USE CASES.
//
void grpc_prefork() { gpr_log(GPR_ERROR, "Forking not supported on Windows"); }
void grpc_prefork() { LOG(ERROR) << "Forking not supported on Windows"; }
void grpc_postfork_parent() {}

@ -14,6 +14,8 @@
#include "src/core/lib/iomgr/internal_errqueue.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -37,7 +39,7 @@ bool KernelSupportsErrqueue() {
// least 4.0.0
struct utsname buffer;
if (uname(&buffer) != 0) {
gpr_log(GPR_ERROR, "uname: %s", StrError(errno).c_str());
LOG(ERROR) << "uname: " << StrError(errno);
return false;
}
char* release = buffer.release;
@ -48,7 +50,7 @@ bool KernelSupportsErrqueue() {
if (strtol(release, nullptr, 10) >= 4) {
return true;
} else {
gpr_log(GPR_DEBUG, "ERRQUEUE support not enabled");
VLOG(2) << "ERRQUEUE support not enabled";
}
#endif // GRPC_LINUX_ERRQUEUE
return false;

@ -27,6 +27,7 @@
#include <limits>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -157,7 +158,7 @@ void grpc_iocp_add_socket(grpc_winsocket* socket) {
(uintptr_t)socket, 0);
if (!ret) {
char* utf8_message = gpr_format_message(WSAGetLastError());
gpr_log(GPR_ERROR, "Unable to add socket to iocp: %s", utf8_message);
LOG(ERROR) << "Unable to add socket to iocp: " << utf8_message;
gpr_free(utf8_message);
__debugbreak();
abort();

@ -44,6 +44,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/support/alloc.h>
@ -411,7 +412,7 @@ grpc_error_handle grpc_set_socket_tcp_user_timeout(
}
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP_USER_TIMEOUT not supported for this platform");
LOG(INFO) << "TCP_USER_TIMEOUT not supported for this platform";
}
}
return absl::OkStatus();
@ -442,7 +443,7 @@ static void probe_ipv6_once(void) {
int fd = socket(AF_INET6, SOCK_STREAM, 0);
g_ipv6_loopback_available = 0;
if (fd < 0) {
gpr_log(GPR_INFO, "Disabling AF_INET6 sockets because socket() failed.");
LOG(INFO) << "Disabling AF_INET6 sockets because socket() failed.";
} else {
grpc_sockaddr_in6 addr;
memset(&addr, 0, sizeof(addr));

@ -28,6 +28,7 @@
#include <mswsock.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_format.h"
#include <grpc/support/alloc.h>
@ -217,7 +218,7 @@ static void probe_ipv6_once(void) {
SOCKET s = socket(AF_INET6, SOCK_STREAM, 0);
g_ipv6_loopback_available = 0;
if (s == INVALID_SOCKET) {
gpr_log(GPR_INFO, "Disabling AF_INET6 sockets because socket() failed.");
LOG(INFO) << "Disabling AF_INET6 sockets because socket() failed.";
} else {
grpc_sockaddr_in6 addr;
memset(&addr, 0, sizeof(addr));

@ -30,6 +30,7 @@
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpc/support/alloc.h>
@ -240,7 +241,7 @@ static void on_writable(void* acp, grpc_error_handle error) {
// your program or another program on the same computer
// opened too many network connections. The "easy" fix:
// don't do that!
gpr_log(GPR_ERROR, "kernel out of buffers");
LOG(ERROR) << "kernel out of buffers";
gpr_mu_unlock(&ac->mu);
grpc_fd_notify_on_write(fd, &ac->write_closure);
return;

@ -875,7 +875,7 @@ static void tcp_trace_read(grpc_tcp* tcp, grpc_error_handle error)
for (i = 0; i < tcp->incoming_buffer->count; i++) {
char* dump = grpc_dump_slice(tcp->incoming_buffer->slices[i],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "READ DATA: %s", dump);
VLOG(2) << "READ DATA: " << dump;
gpr_free(dump);
}
}
@ -1853,7 +1853,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */,
tcp->write_cb = nullptr;
tcp->current_zerocopy_send = nullptr;
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "write: %s", grpc_core::StatusToString(error).c_str());
LOG(INFO) << "write: " << grpc_core::StatusToString(error);
}
// No need to take a ref on error since tcp_flush provides a ref.
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
@ -1877,7 +1877,7 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf,
if (gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
char* data =
grpc_dump_slice(buf->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "WRITE DATA: %s", data);
VLOG(2) << "WRITE DATA: " << data;
gpr_free(data);
}
}
@ -1921,7 +1921,7 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf,
notify_on_write(tcp);
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "write: %s", grpc_core::StatusToString(error).c_str());
LOG(INFO) << "write: " << grpc_core::StatusToString(error);
}
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
}

@ -32,6 +32,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpc/support/alloc.h>
@ -221,7 +222,7 @@ grpc_error_handle grpc_tcp_server_prepare_socket(
err = grpc_set_socket_zerocopy(fd);
if (!err.ok()) {
// it's not fatal, so just log it.
gpr_log(GPR_DEBUG, "Node does not support SO_ZEROCOPY, continuing.");
VLOG(2) << "Node does not support SO_ZEROCOPY, continuing.";
}
#endif
err = grpc_set_socket_nonblocking(fd, 1);

@ -31,6 +31,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpc/support/alloc.h>
@ -115,7 +116,7 @@ grpc_error_handle grpc_tcp_server_add_all_local_addrs(grpc_tcp_server* s,
} else if (requested_port <= 0) {
return GRPC_ERROR_CREATE("Bad get_unused_port()");
}
gpr_log(GPR_DEBUG, "Picked unused port %d", requested_port);
VLOG(2) << "Picked unused port " << requested_port;
}
static bool v4_available = grpc_is_ipv4_availabile();

@ -28,6 +28,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpc/event_engine/endpoint_config.h>
@ -405,7 +406,7 @@ static void on_accept(void* arg, grpc_error_handle error) {
if (!wsa_success) {
if (!sp->shutting_down) {
char* utf8_message = gpr_format_message(WSAGetLastError());
gpr_log(GPR_ERROR, "on_accept error: %s", utf8_message);
LOG(ERROR) << "on_accept error: " << utf8_message;
gpr_free(utf8_message);
}
closesocket(sock);
@ -415,7 +416,7 @@ static void on_accept(void* arg, grpc_error_handle error) {
(char*)&sp->socket->socket, sizeof(sp->socket->socket));
if (err) {
char* utf8_message = gpr_format_message(WSAGetLastError());
gpr_log(GPR_ERROR, "setsockopt error: %s", utf8_message);
LOG(ERROR) << "setsockopt error: " << utf8_message;
gpr_free(utf8_message);
}
int peer_name_len = (int)peer_name.len;
@ -432,7 +433,7 @@ static void on_accept(void* arg, grpc_error_handle error) {
}
} else {
char* utf8_message = gpr_format_message(WSAGetLastError());
gpr_log(GPR_ERROR, "getpeername error: %s", utf8_message);
LOG(ERROR) << "getpeername error: " << utf8_message;
gpr_free(utf8_message);
}
std::string fd_name = absl::StrCat("tcp_server:", peer_name_string);

@ -21,6 +21,7 @@
#include <inttypes.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -89,7 +90,7 @@ static void start_timer_thread_and_unlock(void) {
++g_thread_count;
gpr_mu_unlock(&g_mu);
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "Spawn timer thread");
LOG(INFO) << "Spawn timer thread";
}
completed_thread* ct =
static_cast<completed_thread*>(gpr_malloc(sizeof(*ct)));
@ -125,7 +126,7 @@ static void run_some_timers() {
// waiter so that the next deadline is not missed
if (!g_has_timed_waiter) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "kick untimed waiter");
LOG(INFO) << "kick untimed waiter";
}
gpr_cv_signal(&g_cv_wait);
}
@ -133,7 +134,7 @@ static void run_some_timers() {
}
// without our lock, flush the exec_ctx
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "flush exec_ctx");
LOG(INFO) << "flush exec_ctx";
}
grpc_core::ExecCtx::Get()->Flush();
gpr_mu_lock(&g_mu);
@ -199,7 +200,7 @@ static bool wait_until(grpc_core::Timestamp next) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace) &&
next == grpc_core::Timestamp::InfFuture()) {
gpr_log(GPR_INFO, "sleep until kicked");
LOG(INFO) << "sleep until kicked";
}
gpr_cv_wait(&g_cv_wait, &g_mu, next.as_timespec(GPR_CLOCK_MONOTONIC));
@ -251,7 +252,7 @@ static void timer_main_loop() {
// Consequently, we can just sleep forever here and be happy at some
// saved wakeup cycles.
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "timers not checked: expect another thread to");
LOG(INFO) << "timers not checked: expect another thread to";
}
next = grpc_core::Timestamp::InfFuture();
ABSL_FALLTHROUGH_INTENDED;
@ -277,7 +278,7 @@ static void timer_thread_cleanup(completed_thread* ct) {
g_completed_threads = ct;
gpr_mu_unlock(&g_mu);
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "End timer thread");
LOG(INFO) << "End timer thread";
}
}
@ -318,18 +319,18 @@ void grpc_timer_manager_init(void) {
static void stop_threads(void) {
gpr_mu_lock(&g_mu);
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "stop timer threads: threaded=%d", g_threaded);
LOG(INFO) << "stop timer threads: threaded=" << g_threaded;
}
if (g_threaded) {
g_threaded = false;
gpr_cv_broadcast(&g_cv_wait);
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "num timer threads: %d", g_thread_count);
LOG(INFO) << "num timer threads: " << g_thread_count;
}
while (g_thread_count > 0) {
gpr_cv_wait(&g_cv_shutdown, &g_mu, gpr_inf_future(GPR_CLOCK_MONOTONIC));
if (GRPC_TRACE_FLAG_ENABLED(grpc_timer_check_trace)) {
gpr_log(GPR_INFO, "num timer threads: %d", g_thread_count);
LOG(INFO) << "num timer threads: " << g_thread_count;
}
gc_completed_threads();
}

@ -119,6 +119,12 @@ T* GetContext() {
return p;
}
// Retrieve the current value of a context, or nullptr if the value is unset.
template <typename T>
T* MaybeGetContext() {
return promise_detail::Context<T>::get();
}
// Given a promise and a context, return a promise that has that context set.
template <typename T, typename F>
promise_detail::WithContext<T, F> WithContext(F f, T* context) {

@ -15,6 +15,7 @@
#ifndef GRPC_SRC_CORE_LIB_PROMISE_MAP_PIPE_H
#define GRPC_SRC_CORE_LIB_PROMISE_MAP_PIPE_H
#include "absl/log/log.h"
#include "absl/status/status.h"
#include <grpc/support/log.h>
@ -46,14 +47,14 @@ auto MapPipe(PipeReceiver<T> src, PipeSender<T> dst, Filter filter_factory) {
return TrySeq(
[] {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_DEBUG, "MapPipe: start map");
VLOG(2) << "MapPipe: start map";
}
return Empty{};
},
filter_factory.Make(std::move(t)),
[&dst](T t) {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_DEBUG, "MapPipe: start push");
VLOG(2) << "MapPipe: start push";
}
return Map(dst.Push(std::move(t)), [](bool successful_push) {
if (successful_push) {

@ -23,6 +23,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/types/optional.h"
#include "absl/types/variant.h"
@ -119,7 +120,7 @@ class Center : public InterceptorList<T> {
// Add one ref to this object, and return this.
void IncrementRefCount() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_DEBUG, "%s", DebugOpString("IncrementRefCount").c_str());
VLOG(2) << DebugOpString("IncrementRefCount");
}
refs_++;
DCHECK_NE(refs_, 0);
@ -134,7 +135,7 @@ class Center : public InterceptorList<T> {
// If no refs remain, destroy this object
void Unref() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_DEBUG, "%s", DebugOpString("Unref").c_str());
VLOG(2) << DebugOpString("Unref");
}
DCHECK_GT(refs_, 0);
refs_--;
@ -149,7 +150,7 @@ class Center : public InterceptorList<T> {
// Return false if the recv end is closed.
Poll<bool> Push(T* value) {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("Push").c_str());
LOG(INFO) << DebugOpString("Push");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -173,7 +174,7 @@ class Center : public InterceptorList<T> {
Poll<bool> PollAck() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("PollAck").c_str());
LOG(INFO) << DebugOpString("PollAck");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -201,7 +202,7 @@ class Center : public InterceptorList<T> {
// Return nullopt if the send end is closed and no value had been pushed.
Poll<absl::optional<T>> Next() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("Next").c_str());
LOG(INFO) << DebugOpString("Next");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -227,7 +228,7 @@ class Center : public InterceptorList<T> {
// but the pipe is closed, reports closed).
Poll<bool> PollClosedForSender() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("PollClosedForSender").c_str());
LOG(INFO) << DebugOpString("PollClosedForSender");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -250,7 +251,7 @@ class Center : public InterceptorList<T> {
// but the pipe is closed, reports open).
Poll<bool> PollClosedForReceiver() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("PollClosedForReceiver").c_str());
LOG(INFO) << DebugOpString("PollClosedForReceiver");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -271,7 +272,7 @@ class Center : public InterceptorList<T> {
Poll<Empty> PollEmpty() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("PollEmpty").c_str());
LOG(INFO) << DebugOpString("PollEmpty");
}
DCHECK_NE(refs_, 0);
switch (value_state_) {
@ -291,7 +292,7 @@ class Center : public InterceptorList<T> {
void AckNext() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("AckNext").c_str());
LOG(INFO) << DebugOpString("AckNext");
}
switch (value_state_) {
case ValueState::kReady:
@ -318,7 +319,7 @@ class Center : public InterceptorList<T> {
void MarkClosed() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("MarkClosed").c_str());
LOG(INFO) << DebugOpString("MarkClosed");
}
switch (value_state_) {
case ValueState::kEmpty:
@ -347,7 +348,7 @@ class Center : public InterceptorList<T> {
void MarkCancelled() {
if (grpc_trace_promise_primitives.enabled()) {
gpr_log(GPR_INFO, "%s", DebugOpString("MarkCancelled").c_str());
LOG(INFO) << DebugOpString("MarkCancelled");
}
switch (value_state_) {
case ValueState::kEmpty:

@ -16,6 +16,7 @@
#include <string.h>
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
@ -41,7 +42,7 @@ EvaluateArgs::PerChannelArgs::Address ParseEndpointUri(
EvaluateArgs::PerChannelArgs::Address address;
absl::StatusOr<URI> uri = URI::Parse(uri_text);
if (!uri.ok()) {
gpr_log(GPR_DEBUG, "Failed to parse uri.");
VLOG(2) << "Failed to parse uri.";
return address;
}
absl::string_view host_view;

@ -23,6 +23,7 @@
#include <algorithm>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/credentials.h>
#include <grpc/grpc_security.h>
@ -52,7 +53,7 @@ grpc_call_error grpc_call_set_credentials(grpc_call* call,
GRPC_API_TRACE("grpc_call_set_credentials(call=%p, creds=%p)", 2,
(call, creds));
if (!grpc_call_is_client(call)) {
gpr_log(GPR_ERROR, "Method is client-side only.");
LOG(ERROR) << "Method is client-side only.";
return GRPC_CALL_ERROR_NOT_ON_SERVER;
}
ctx = static_cast<grpc_client_security_context*>(

@ -22,6 +22,8 @@
#include <stdio.h>
#include <string.h>
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -56,7 +58,7 @@ namespace internal {
char* read_bios_file(const char* bios_file) {
FILE* fp = fopen(bios_file, "r");
if (!fp) {
gpr_log(GPR_INFO, "BIOS data file does not exist or cannot be opened.");
LOG(INFO) << "BIOS data file does not exist or cannot be opened.";
return nullptr;
}
char buf[kBiosDataBufferSize + 1];

@ -18,6 +18,7 @@
#include <string.h>
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -47,7 +48,7 @@ ServiceUrlAndMethod MakeServiceUrlAndMethod(
auto last_slash = service.find_last_of('/');
absl::string_view method_name;
if (last_slash == absl::string_view::npos) {
gpr_log(GPR_ERROR, "No '/' found in fully qualified method name");
LOG(ERROR) << "No '/' found in fully qualified method name";
service = "";
method_name = "";
} else if (last_slash == 0) {

@ -24,6 +24,7 @@
#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
@ -137,7 +138,7 @@ grpc_google_default_channel_credentials::create_security_connector(
is_xds_non_cfe_cluster;
// Return failure if ALTS is selected but not running on GCE.
if (use_alts && alts_creds_ == nullptr) {
gpr_log(GPR_ERROR, "ALTS is selected, but not running on GCE.");
LOG(ERROR) << "ALTS is selected, but not running on GCE.";
return nullptr;
}
grpc_core::RefCountedPtr<grpc_channel_security_connector> sc =

@ -30,6 +30,7 @@
#include <openssl/rsa.h>
#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"
@ -86,7 +87,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json& json) {
memset(&result, 0, sizeof(grpc_auth_json_key));
result.type = GRPC_AUTH_JSON_TYPE_INVALID;
if (json.type() == Json::Type::kNull) {
gpr_log(GPR_ERROR, "Invalid json.");
LOG(ERROR) << "Invalid json.";
goto end;
}
@ -114,7 +115,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json& json) {
bio = BIO_new(BIO_s_mem());
success = BIO_puts(bio, prop_value);
if ((success < 0) || (static_cast<size_t>(success) != strlen(prop_value))) {
gpr_log(GPR_ERROR, "Could not write into openssl BIO.");
LOG(ERROR) << "Could not write into openssl BIO.";
goto end;
}
#if OPENSSL_VERSION_NUMBER < 0x30000000L
@ -124,7 +125,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json& json) {
result.private_key = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr);
#endif
if (result.private_key == nullptr) {
gpr_log(GPR_ERROR, "Could not deserialize private key.");
LOG(ERROR) << "Could not deserialize private key.";
goto end;
}
success = 1;
@ -191,7 +192,7 @@ static char* encoded_jwt_claim(const grpc_auth_json_key* json_key,
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec expiration = gpr_time_add(now, token_lifetime);
if (gpr_time_cmp(token_lifetime, grpc_max_auth_token_lifetime()) > 0) {
gpr_log(GPR_INFO, "Cropping token lifetime to maximum allowed value.");
LOG(INFO) << "Cropping token lifetime to maximum allowed value.";
expiration = gpr_time_add(now, grpc_max_auth_token_lifetime());
}
@ -256,7 +257,7 @@ char* compute_and_encode_signature(const grpc_auth_json_key* json_key,
if (md == nullptr) return nullptr;
md_ctx = EVP_MD_CTX_create();
if (md_ctx == nullptr) {
gpr_log(GPR_ERROR, "Could not create MD_CTX");
LOG(ERROR) << "Could not create MD_CTX";
goto end;
}
#if OPENSSL_VERSION_NUMBER < 0x30000000L
@ -266,20 +267,20 @@ char* compute_and_encode_signature(const grpc_auth_json_key* json_key,
if (EVP_DigestSignInit(md_ctx, nullptr, md, nullptr, json_key->private_key) !=
1) {
#endif
gpr_log(GPR_ERROR, "DigestInit failed.");
LOG(ERROR) << "DigestInit failed.";
goto end;
}
if (EVP_DigestSignUpdate(md_ctx, to_sign, strlen(to_sign)) != 1) {
gpr_log(GPR_ERROR, "DigestUpdate failed.");
LOG(ERROR) << "DigestUpdate failed.";
goto end;
}
if (EVP_DigestSignFinal(md_ctx, nullptr, &sig_len) != 1) {
gpr_log(GPR_ERROR, "DigestFinal (get signature length) failed.");
LOG(ERROR) << "DigestFinal (get signature length) failed.";
goto end;
}
sig = static_cast<unsigned char*>(gpr_malloc(sig_len));
if (EVP_DigestSignFinal(md_ctx, sig, &sig_len) != 1) {
gpr_log(GPR_ERROR, "DigestFinal (signature compute) failed.");
LOG(ERROR) << "DigestFinal (signature compute) failed.";
goto end;
}
result =

@ -25,6 +25,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
@ -134,7 +135,7 @@ grpc_core::RefCountedPtr<grpc_call_credentials>
grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
grpc_auth_json_key key, gpr_timespec token_lifetime) {
if (!grpc_auth_json_key_is_valid(&key)) {
gpr_log(GPR_ERROR, "Invalid input for jwt credentials creation");
LOG(ERROR) << "Invalid input for jwt credentials creation";
return nullptr;
}
return grpc_core::MakeRefCounted<grpc_service_account_jwt_access_credentials>(

@ -28,6 +28,7 @@
#include <vector>
#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"
@ -86,7 +87,7 @@ grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
memset(&result, 0, sizeof(grpc_auth_refresh_token));
result.type = GRPC_AUTH_JSON_TYPE_INVALID;
if (json.type() != Json::Type::kObject) {
gpr_log(GPR_ERROR, "Invalid json.");
LOG(ERROR) << "Invalid json.";
goto end;
}
@ -161,7 +162,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
grpc_credentials_status status = GRPC_CREDENTIALS_OK;
if (response == nullptr) {
gpr_log(GPR_ERROR, "Received NULL response.");
LOG(ERROR) << "Received NULL response.";
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
@ -193,14 +194,14 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
goto end;
}
if (json->type() != Json::Type::kObject) {
gpr_log(GPR_ERROR, "Response should be a JSON object");
LOG(ERROR) << "Response should be a JSON object";
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
it = json->object().find("access_token");
if (it == json->object().end() ||
it->second.type() != Json::Type::kString) {
gpr_log(GPR_ERROR, "Missing or invalid access_token in JSON.");
LOG(ERROR) << "Missing or invalid access_token in JSON.";
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
@ -208,7 +209,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
it = json->object().find("token_type");
if (it == json->object().end() ||
it->second.type() != Json::Type::kString) {
gpr_log(GPR_ERROR, "Missing or invalid token_type in JSON.");
LOG(ERROR) << "Missing or invalid token_type in JSON.";
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
@ -216,7 +217,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
it = json->object().find("expires_in");
if (it == json->object().end() ||
it->second.type() != Json::Type::kNumber) {
gpr_log(GPR_ERROR, "Missing or invalid expires_in in JSON.");
LOG(ERROR) << "Missing or invalid expires_in in JSON.";
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
@ -479,7 +480,7 @@ grpc_core::RefCountedPtr<grpc_call_credentials>
grpc_refresh_token_credentials_create_from_auth_refresh_token(
grpc_auth_refresh_token refresh_token) {
if (!grpc_auth_refresh_token_is_valid(&refresh_token)) {
gpr_log(GPR_ERROR, "Invalid input for refresh token credentials creation");
LOG(ERROR) << "Invalid input for refresh token credentials creation";
return nullptr;
}
return grpc_core::MakeRefCounted<grpc_google_refresh_token_credentials>(

@ -22,6 +22,7 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -83,7 +84,7 @@ grpc_plugin_credentials::PendingRequest::ProcessPluginResult(
!GRPC_LOG_IF_ERROR(
"validate_metadata_from_plugin",
grpc_validate_header_nonbin_value_is_legal(md[i].value))) {
gpr_log(GPR_ERROR, "Plugin added invalid metadata value.");
LOG(ERROR) << "Plugin added invalid metadata value.";
seen_illegal_header = true;
break;
}

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/types/optional.h"
#include <grpc/impl/channel_arg_names.h>
@ -54,7 +55,7 @@ grpc_ssl_credentials::grpc_ssl_credentials(
const char* pem_root_certs =
grpc_core::DefaultSslRootStore::GetPemRootCerts();
if (pem_root_certs == nullptr) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
LOG(ERROR) << "Could not get default pem root certs.";
} else {
char* default_roots = gpr_strdup(pem_root_certs);
config_.pem_root_certs = default_roots;
@ -378,7 +379,7 @@ grpc_ssl_server_credentials_create_options_using_config(
grpc_ssl_server_certificate_config* config) {
grpc_ssl_server_credentials_options* options = nullptr;
if (config == nullptr) {
gpr_log(GPR_ERROR, "Certificate config must not be NULL.");
LOG(ERROR) << "Certificate config must not be NULL.";
goto done;
}
options = static_cast<grpc_ssl_server_credentials_options*>(
@ -394,7 +395,7 @@ grpc_ssl_server_credentials_create_options_using_config_fetcher(
grpc_ssl_client_certificate_request_type client_certificate_request,
grpc_ssl_server_certificate_config_callback cb, void* user_data) {
if (cb == nullptr) {
gpr_log(GPR_ERROR, "Invalid certificate config callback parameter.");
LOG(ERROR) << "Invalid certificate config callback parameter.";
return nullptr;
}
@ -466,7 +467,7 @@ grpc_server_credentials* grpc_ssl_server_credentials_create_with_options(
goto done;
} else if (options->certificate_config_fetcher != nullptr &&
options->certificate_config_fetcher->cb == nullptr) {
gpr_log(GPR_ERROR, "Certificate config fetcher callback must not be NULL.");
LOG(ERROR) << "Certificate config fetcher callback must not be NULL.";
goto done;
}

@ -21,6 +21,7 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/grpc_crl_provider.h>
#include <grpc/support/log.h>
@ -131,7 +132,7 @@ void grpc_tls_credentials_options_set_tls_session_key_log_file_path(
gpr_log(GPR_INFO,
"Enabling TLS session key logging with keys stored at: %s", path);
} else {
gpr_log(GPR_INFO, "Disabling TLS session key logging");
LOG(INFO) << "Disabling TLS session key logging";
}
options->set_tls_session_key_log_file_path(path != nullptr ? path : "");
}

@ -22,6 +22,7 @@
#include <string>
#include <utility>
#include "absl/log/log.h"
#include "absl/types/optional.h"
#include <grpc/grpc.h>
@ -42,22 +43,22 @@ namespace {
bool CredentialOptionSanityCheck(grpc_tls_credentials_options* options,
bool is_client) {
if (options == nullptr) {
gpr_log(GPR_ERROR, "TLS credentials options is nullptr.");
LOG(ERROR) << "TLS credentials options is nullptr.";
return false;
}
// In this case, there will be non-retriable handshake errors.
if (options->min_tls_version() > options->max_tls_version()) {
gpr_log(GPR_ERROR, "TLS min version must not be higher than max version.");
LOG(ERROR) << "TLS min version must not be higher than max version.";
grpc_tls_credentials_options_destroy(options);
return false;
}
if (options->max_tls_version() > grpc_tls_version::TLS1_3) {
gpr_log(GPR_ERROR, "TLS max version must not be higher than v1.3.");
LOG(ERROR) << "TLS max version must not be higher than v1.3.";
grpc_tls_credentials_options_destroy(options);
return false;
}
if (options->min_tls_version() < grpc_tls_version::TLS1_2) {
gpr_log(GPR_ERROR, "TLS min version must not be lower than v1.2.");
LOG(ERROR) << "TLS min version must not be lower than v1.2.";
grpc_tls_credentials_options_destroy(options);
return false;
}

@ -32,6 +32,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -110,7 +112,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
if (stat_return == -1 || !S_ISREG(dir_entry_stat.st_mode)) {
// no subdirectories.
if (stat_return == -1) {
gpr_log(GPR_ERROR, "failed to get status for file: %s", file_data.path);
LOG(ERROR) << "failed to get status for file: " << file_data.path;
}
continue;
}
@ -131,7 +133,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
if (read_ret != -1) {
bytes_read += read_ret;
} else {
gpr_log(GPR_ERROR, "failed to read file: %s", roots_filenames[i].path);
LOG(ERROR) << "failed to read file: " << roots_filenames[i].path;
}
}
}

@ -25,6 +25,7 @@
#include <utility>
#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"
@ -380,7 +381,7 @@ grpc_ssl_channel_security_connector_create(
const char* overridden_target_name,
tsi_ssl_client_handshaker_factory* client_factory) {
if (config == nullptr || target_name == nullptr) {
gpr_log(GPR_ERROR, "An ssl channel needs a config and a target name.");
LOG(ERROR) << "An ssl channel needs a config and a target name.";
return nullptr;
}

@ -26,6 +26,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
@ -123,7 +124,7 @@ tsi_tls_version grpc_get_tsi_tls_version(grpc_tls_version tls_version) {
case grpc_tls_version::TLS1_3:
return tsi_tls_version::TSI_TLS1_3;
default:
gpr_log(GPR_INFO, "Falling back to TLS 1.2.");
LOG(INFO) << "Falling back to TLS 1.2.";
return tsi_tls_version::TSI_TLS1_2;
}
}
@ -180,7 +181,7 @@ absl::Status SslCheckCallHost(absl::string_view host,
status = GRPC_SECURITY_OK;
}
if (status != GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR, "call host does not match SSL server name");
LOG(ERROR) << "call host does not match SSL server name";
grpc_shallow_peer_destruct(&peer);
return absl::UnauthenticatedError(
"call host does not match SSL server name");
@ -232,16 +233,16 @@ static bool IsSpiffeId(absl::string_view uri) {
return false;
};
if (uri.size() > 2048) {
gpr_log(GPR_INFO, "Invalid SPIFFE ID: ID longer than 2048 bytes.");
LOG(INFO) << "Invalid SPIFFE ID: ID longer than 2048 bytes.";
return false;
}
std::vector<absl::string_view> splits = absl::StrSplit(uri, '/');
if (splits.size() < 4 || splits[3].empty()) {
gpr_log(GPR_INFO, "Invalid SPIFFE ID: workload id is empty.");
LOG(INFO) << "Invalid SPIFFE ID: workload id is empty.";
return false;
}
if (splits[2].size() > 255) {
gpr_log(GPR_INFO, "Invalid SPIFFE ID: domain longer than 255 characters.");
LOG(INFO) << "Invalid SPIFFE ID: domain longer than 255 characters.";
return false;
}
return true;
@ -332,7 +333,7 @@ grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
GRPC_PEER_SPIFFE_ID_PROPERTY_NAME,
spiffe_data, spiffe_length);
} else {
gpr_log(GPR_INFO, "Invalid SPIFFE ID: multiple URI SANs.");
LOG(INFO) << "Invalid SPIFFE ID: multiple URI SANs.";
}
}
return ctx;
@ -425,7 +426,7 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
// Use default root certificates.
root_certs = grpc_core::DefaultSslRootStore::GetPemRootCerts();
if (root_certs == nullptr) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
LOG(ERROR) << "Could not get default pem root certs.";
return GRPC_SECURITY_ERROR;
}
root_store = grpc_core::DefaultSslRootStore::GetRootStore();

@ -26,6 +26,7 @@
#include "absl/functional/bind_front.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -452,7 +453,7 @@ void TlsChannelSecurityConnector::TlsChannelCertificateWatcher::
if (root_ready && identity_ready) {
if (security_connector_->UpdateHandshakerFactoryLocked() !=
GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR, "Update handshaker factory failed.");
LOG(ERROR) << "Update handshaker factory failed.";
}
}
}
@ -721,7 +722,7 @@ void TlsServerSecurityConnector::TlsServerCertificateWatcher::
(!root_being_watched && identity_being_watched && identity_has_value)) {
if (security_connector_->UpdateHandshakerFactoryLocked() !=
GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR, "Update handshaker factory failed.");
LOG(ERROR) << "Update handshaker factory failed.";
}
}
}

@ -325,7 +325,7 @@ void Call::HandleCompressionAlgorithmDisabled(
grpc_compression_algorithm_name(compression_algorithm, &algo_name);
std::string error_msg =
absl::StrFormat("Compression algorithm '%s' is disabled.", algo_name);
gpr_log(GPR_ERROR, "%s", error_msg.c_str());
LOG(ERROR) << error_msg;
CancelWithError(grpc_error_set_int(absl::UnimplementedError(error_msg),
StatusIntProperty::kRpcStatus,
GRPC_STATUS_UNIMPLEMENTED));

@ -27,6 +27,7 @@
#include <type_traits>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
@ -313,7 +314,7 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
const auto filter_str =
absl::StrCat(" ", loc_strs[filter.filter],
NameFromChannelFilter(filter.filter), after_str);
gpr_log(GPR_INFO, "%s", filter_str.c_str());
LOG(INFO) << filter_str;
}
// Finally list out the terminal filters and where they were registered
// from.
@ -325,7 +326,7 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
strlen(NameFromChannelFilter(terminal.filter)),
' '),
"[terminal]");
gpr_log(GPR_INFO, "%s", filter_str.c_str());
LOG(INFO) << filter_str;
}
}
// Check if there are no terminal filters: this would be an error.
@ -398,7 +399,7 @@ bool ChannelInit::CreateStack(ChannelStackBuilder* builder) const {
"\n");
}
}
gpr_log(GPR_ERROR, "%s", error.c_str());
LOG(ERROR) << error;
return false;
}
for (const auto& post_processor : stack_config.post_processors) {

@ -28,6 +28,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
@ -260,7 +261,7 @@ struct cq_next_data {
CHECK_EQ(queue.num_items(), 0);
#ifndef NDEBUG
if (pending_events.load(std::memory_order_acquire) != 0) {
gpr_log(GPR_ERROR, "Destroying CQ without draining it fully.");
LOG(ERROR) << "Destroying CQ without draining it fully.";
}
#endif
}
@ -290,7 +291,7 @@ struct cq_pluck_data {
CHECK(completed_head.next == reinterpret_cast<uintptr_t>(&completed_head));
#ifndef NDEBUG
if (pending_events.load(std::memory_order_acquire) != 0) {
gpr_log(GPR_ERROR, "Destroying CQ without draining it fully.");
LOG(ERROR) << "Destroying CQ without draining it fully.";
}
#endif
}
@ -327,7 +328,7 @@ struct cq_callback_data {
~cq_callback_data() {
#ifndef NDEBUG
if (pending_events.load(std::memory_order_acquire) != 0) {
gpr_log(GPR_ERROR, "Destroying CQ without draining it fully.");
LOG(ERROR) << "Destroying CQ without draining it fully.";
}
#endif
}
@ -942,7 +943,7 @@ static void dump_pending_tags(grpc_completion_queue* cq) {
parts.push_back(absl::StrFormat(" %p", cq->outstanding_tags[i]));
}
gpr_mu_unlock(cq->mu);
gpr_log(GPR_DEBUG, "%s", absl::StrJoin(parts, "").c_str());
VLOG(2) << absl::StrJoin(parts, "");
}
#else
static void dump_pending_tags(grpc_completion_queue* /*cq*/) {}

@ -19,6 +19,7 @@
#include "src/core/lib/surface/init.h"
#include "absl/base/thread_annotations.h"
#include "absl/log/log.h"
#include <grpc/fork.h>
#include <grpc/grpc.h>
@ -137,7 +138,7 @@ void grpc_shutdown_from_cleanup_thread(void* /*ignored*/) {
return;
}
grpc_shutdown_internal_locked();
gpr_log(GPR_DEBUG, "grpc_shutdown from cleanup thread done");
VLOG(2) << "grpc_shutdown from cleanup thread done";
}
void grpc_shutdown(void) {
@ -155,14 +156,14 @@ void grpc_shutdown(void) {
0) &&
grpc_core::ExecCtx::Get() == nullptr) {
// just run clean-up when this is called on non-executor thread.
gpr_log(GPR_DEBUG, "grpc_shutdown starts clean-up now");
VLOG(2) << "grpc_shutdown starts clean-up now";
g_shutting_down = true;
grpc_shutdown_internal_locked();
gpr_log(GPR_DEBUG, "grpc_shutdown done");
VLOG(2) << "grpc_shutdown done";
} else {
// spawn a detached thread to do the actual clean up in case we are
// currently in an executor thread.
gpr_log(GPR_DEBUG, "grpc_shutdown spawns clean-up thread");
VLOG(2) << "grpc_shutdown spawns clean-up thread";
g_initializations++;
g_shutting_down = true;
grpc_core::Thread cleanup_thread(

@ -93,13 +93,13 @@ absl::StatusOr<OrphanablePtr<Channel>> LegacyChannel::Create(
*(*r)->stats_plugin_group =
GlobalStatsPluginRegistry::GetStatsPluginsForServer(args);
} else {
experimental::StatsPluginChannelScope scope(
target, args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY)
std::string authority = args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY)
.value_or(CoreConfiguration::Get()
.resolver_registry()
.GetDefaultAuthority(target)));
.GetDefaultAuthority(target));
*(*r)->stats_plugin_group =
GlobalStatsPluginRegistry::GetStatsPluginsForChannel(scope);
GlobalStatsPluginRegistry::GetStatsPluginsForChannel(
experimental::StatsPluginChannelScope(target, authority));
}
return MakeOrphanable<LegacyChannel>(
grpc_channel_stack_type_is_client(builder.channel_stack_type()),

@ -37,6 +37,7 @@
#include <memory>
#include <utility>
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -126,12 +127,12 @@ class BinderResolverFactory final : public ResolverFactory {
grpc_resolved_address addr;
{
if (!uri.authority().empty()) {
gpr_log(GPR_ERROR, "authority is not supported in binder scheme");
LOG(ERROR) << "authority is not supported in binder scheme";
return false;
}
grpc_error_handle error = BinderAddrPopulate(uri.path(), &addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", StatusToString(error).c_str());
LOG(ERROR) << StatusToString(error);
return false;
}
}

@ -24,6 +24,7 @@
#include <vector>
#include "absl/base/thread_annotations.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
@ -348,7 +349,7 @@ class AresClientChannelDNSResolverFactory final : public ResolverFactory {
bool IsValidUri(const URI& uri) const override {
if (absl::StripPrefix(uri.path(), "/").empty()) {
gpr_log(GPR_ERROR, "no server name supplied in dns URI");
LOG(ERROR) << "no server name supplied in dns URI";
return false;
}
return true;

@ -19,6 +19,7 @@
#include <algorithm>
#include <vector>
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include <grpc/impl/channel_arg_names.h>
@ -952,7 +953,7 @@ static bool resolve_as_ip_literal_locked(
static bool target_matches_localhost_inner(const char* name, std::string* host,
std::string* port) {
if (!grpc_core::SplitHostPort(name, host, port)) {
gpr_log(GPR_ERROR, "Unable to split host and port for name: %s", name);
LOG(ERROR) << "Unable to split host and port for name: " << name;
return false;
}
return gpr_stricmp(host->c_str(), "localhost") == 0;

@ -15,6 +15,7 @@
#include <memory>
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include <grpc/support/log.h>
@ -32,14 +33,14 @@ namespace grpc_core {
void RegisterDnsResolver(CoreConfiguration::Builder* builder) {
#ifdef GRPC_IOS_EVENT_ENGINE_CLIENT
gpr_log(GPR_DEBUG, "Using EventEngine dns resolver");
VLOG(2) << "Using EventEngine dns resolver";
builder->resolver_registry()->RegisterResolverFactory(
std::make_unique<EventEngineClientChannelDNSResolverFactory>());
return;
#endif
#ifndef GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER
if (IsEventEngineDnsEnabled()) {
gpr_log(GPR_DEBUG, "Using EventEngine dns resolver");
VLOG(2) << "Using EventEngine dns resolver";
builder->resolver_registry()->RegisterResolverFactory(
std::make_unique<EventEngineClientChannelDNSResolverFactory>());
return;
@ -48,14 +49,14 @@ void RegisterDnsResolver(CoreConfiguration::Builder* builder) {
auto resolver = ConfigVars::Get().DnsResolver();
// ---- Ares resolver ----
if (ShouldUseAresDnsResolver(resolver)) {
gpr_log(GPR_DEBUG, "Using ares dns resolver");
VLOG(2) << "Using ares dns resolver";
RegisterAresDnsResolver(builder);
return;
}
// ---- Native resolver ----
if (absl::EqualsIgnoreCase(resolver, "native") ||
!builder->resolver_registry()->HasResolverFactory("dns")) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
VLOG(2) << "Using native dns resolver";
RegisterNativeDnsResolver(builder);
return;
}

@ -26,6 +26,7 @@
#include "absl/base/thread_annotations.h"
#include "absl/cleanup/cleanup.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
@ -567,7 +568,7 @@ absl::optional<Resolver::Result> EventEngineClientChannelDNSResolver::
bool EventEngineClientChannelDNSResolverFactory::IsValidUri(
const URI& uri) const {
if (absl::StripPrefix(uri.path(), "/").empty()) {
gpr_log(GPR_ERROR, "no server name supplied in dns URI");
LOG(ERROR) << "no server name supplied in dns URI";
return false;
}
return true;

@ -20,6 +20,7 @@
#include <vector>
#include "absl/functional/bind_front.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -150,11 +151,11 @@ class NativeClientChannelDNSResolverFactory final : public ResolverFactory {
bool IsValidUri(const URI& uri) const override {
if (GPR_UNLIKELY(!uri.authority().empty())) {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
LOG(ERROR) << "authority based dns uri's not supported";
return false;
}
if (absl::StripPrefix(uri.path(), "/").empty()) {
gpr_log(GPR_ERROR, "no server name supplied in dns URI");
LOG(ERROR) << "no server name supplied in dns URI";
return false;
}
return true;

@ -22,6 +22,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -282,7 +283,7 @@ class GoogleCloud2ProdResolverFactory final : public ResolverFactory {
bool IsValidUri(const URI& uri) const override {
if (GPR_UNLIKELY(!uri.authority().empty())) {
gpr_log(GPR_ERROR, "google-c2p URI scheme does not support authorities");
LOG(ERROR) << "google-c2p URI scheme does not support authorities";
return false;
}
return true;

@ -33,6 +33,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/types/optional.h"
@ -980,7 +981,7 @@ grpc_error_handle Server::SetupTransport(
}
t->StartConnectivityWatch(MakeOrphanable<TransportConnectivityWatcher>(
t->RefAsSubclass<ServerTransport>(), Ref()));
gpr_log(GPR_INFO, "Adding connection");
LOG(INFO) << "Adding connection";
connections_.emplace(std::move(t));
++connections_open_;
} else {
@ -1494,7 +1495,7 @@ void Server::ChannelData::Destroy() {
GRPC_CLOSURE_INIT(&finish_destroy_channel_closure_, FinishDestroy, this,
grpc_schedule_on_exec_ctx);
if (GRPC_TRACE_FLAG_ENABLED(grpc_server_channel_trace)) {
gpr_log(GPR_INFO, "Disconnected client");
LOG(INFO) << "Disconnected client";
}
grpc_transport_op* op =
grpc_make_transport_op(&finish_destroy_channel_closure_);

@ -22,6 +22,7 @@
#include <string>
#include <utility>
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/types/optional.h"
@ -69,7 +70,7 @@ class ServiceConfigChannelArgFilter final
auto service_config =
ServiceConfigImpl::Create(args, *service_config_str);
if (!service_config.ok()) {
gpr_log(GPR_ERROR, "%s", service_config.status().ToString().c_str());
LOG(ERROR) << service_config.status().ToString();
} else {
service_config_ = std::move(*service_config);
}

@ -24,10 +24,10 @@
#include <algorithm>
#include <memory>
#include "absl/log/log.h"
#include "absl/types/span.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/memory.h"
@ -70,7 +70,7 @@ static tsi_result seal(alts_frame_protector* impl) {
&output_size, &error_details);
impl->in_place_protect_bytes_buffered = output_size;
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "%s", error_details);
LOG(ERROR) << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}
@ -88,7 +88,7 @@ static tsi_result alts_protect_flush(tsi_frame_protector* self,
if (self == nullptr || protected_output_frames == nullptr ||
protected_output_frames_size == nullptr ||
still_pending_size == nullptr) {
gpr_log(GPR_ERROR, "Invalid nullptr arguments to alts_protect_flush().");
LOG(ERROR) << "Invalid nullptr arguments to alts_protect_flush().";
return TSI_INVALID_ARGUMENT;
}
alts_frame_protector* impl = reinterpret_cast<alts_frame_protector*>(self);
@ -113,7 +113,7 @@ static tsi_result alts_protect_flush(tsi_frame_protector* self,
}
if (!alts_reset_frame_writer(impl->writer, impl->in_place_protect_buffer,
impl->in_place_protect_bytes_buffered)) {
gpr_log(GPR_ERROR, "Couldn't reset frame writer.");
LOG(ERROR) << "Couldn't reset frame writer.";
return TSI_INTERNAL_ERROR;
}
}
@ -126,7 +126,7 @@ static tsi_result alts_protect_flush(tsi_frame_protector* self,
size_t written_frame_bytes = *protected_output_frames_size;
if (!alts_write_frame_bytes(impl->writer, protected_output_frames,
&written_frame_bytes)) {
gpr_log(GPR_ERROR, "Couldn't write frame bytes.");
LOG(ERROR) << "Couldn't write frame bytes.";
return TSI_INTERNAL_ERROR;
}
*protected_output_frames_size = written_frame_bytes;
@ -149,7 +149,7 @@ static tsi_result alts_protect(tsi_frame_protector* self,
if (self == nullptr || unprotected_bytes == nullptr ||
unprotected_bytes_size == nullptr || protected_output_frames == nullptr ||
protected_output_frames_size == nullptr) {
gpr_log(GPR_ERROR, "Invalid nullptr arguments to alts_protect().");
LOG(ERROR) << "Invalid nullptr arguments to alts_protect().";
return TSI_INVALID_ARGUMENT;
}
alts_frame_protector* impl = reinterpret_cast<alts_frame_protector*>(self);
@ -202,7 +202,7 @@ static tsi_result unseal(alts_frame_protector* impl) {
impl->max_unprotected_frame_size,
alts_get_output_bytes_read(impl->reader), &output_size, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "%s", error_details);
LOG(ERROR) << error_details;
gpr_free(error_details);
return TSI_DATA_CORRUPTED;
}
@ -241,7 +241,7 @@ static tsi_result alts_unprotect(tsi_frame_protector* self,
if (self == nullptr || protected_frames_bytes == nullptr ||
protected_frames_bytes_size == nullptr || unprotected_bytes == nullptr ||
unprotected_bytes_size == nullptr) {
gpr_log(GPR_ERROR, "Invalid nullptr arguments to alts_unprotect().");
LOG(ERROR) << "Invalid nullptr arguments to alts_unprotect().";
return TSI_INVALID_ARGUMENT;
}
alts_frame_protector* impl = reinterpret_cast<alts_frame_protector*>(self);
@ -256,7 +256,7 @@ static tsi_result alts_unprotect(tsi_frame_protector* self,
impl->in_place_unprotect_bytes_processed + impl->overhead_length))) {
if (!alts_reset_frame_reader(impl->reader,
impl->in_place_unprotect_buffer)) {
gpr_log(GPR_ERROR, "Couldn't reset frame reader.");
LOG(ERROR) << "Couldn't reset frame reader.";
return TSI_INTERNAL_ERROR;
}
impl->in_place_unprotect_bytes_processed = 0;
@ -276,7 +276,7 @@ static tsi_result alts_unprotect(tsi_frame_protector* self,
size_t read_frames_bytes_size = *protected_frames_bytes_size;
if (!alts_read_frame_bytes(impl->reader, protected_frames_bytes,
&read_frames_bytes_size)) {
gpr_log(GPR_ERROR, "Failed to process frame.");
LOG(ERROR) << "Failed to process frame.";
return TSI_INTERNAL_ERROR;
}
*protected_frames_bytes_size = read_frames_bytes_size;
@ -370,8 +370,7 @@ tsi_result alts_create_frame_protector(const uint8_t* key, size_t key_size,
size_t* max_protected_frame_size,
tsi_frame_protector** self) {
if (key == nullptr || self == nullptr) {
gpr_log(GPR_ERROR,
"Invalid nullptr arguments to alts_create_frame_protector().");
LOG(ERROR) << "Invalid nullptr arguments to alts_create_frame_protector().";
return TSI_INTERNAL_ERROR;
}
char* error_details = nullptr;
@ -379,7 +378,7 @@ tsi_result alts_create_frame_protector(const uint8_t* key, size_t key_size,
grpc_status_code status = create_alts_crypters(
key, key_size, is_client, is_rekey, impl, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to create ALTS crypters, %s.", error_details);
LOG(ERROR) << "Failed to create ALTS crypters, " << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}

@ -21,6 +21,7 @@
#include <list>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/numbers.h"
#include "upb/mem/arena.hpp"
@ -205,13 +206,13 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
alts_tsi_handshaker* handshaker = client->handshaker;
// Invalid input check.
if (client->cb == nullptr) {
gpr_log(GPR_ERROR,
"client->cb is nullptr in alts_tsi_handshaker_handle_response()");
LOG(ERROR)
<< "client->cb is nullptr in alts_tsi_handshaker_handle_response()";
return;
}
if (handshaker == nullptr) {
gpr_log(GPR_ERROR,
"handshaker is nullptr in alts_tsi_handshaker_handle_response()");
LOG(ERROR)
<< "handshaker is nullptr in alts_tsi_handshaker_handle_response()";
handle_response_done(
client, TSI_INTERNAL_ERROR,
"handshaker is nullptr in alts_tsi_handshaker_handle_response()",
@ -220,14 +221,14 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
}
// TSI handshake has been shutdown.
if (alts_tsi_handshaker_has_shutdown(handshaker)) {
gpr_log(GPR_INFO, "TSI handshake shutdown");
LOG(INFO) << "TSI handshake shutdown";
handle_response_done(client, TSI_HANDSHAKE_SHUTDOWN,
"TSI handshake shutdown", nullptr, 0, nullptr);
return;
}
// Check for failed grpc read.
if (!is_ok || client->inject_read_failure) {
gpr_log(GPR_INFO, "read failed on grpc call to handshaker service");
LOG(INFO) << "read failed on grpc call to handshaker service";
handle_response_done(client, TSI_INTERNAL_ERROR,
"read failed on grpc call to handshaker service",
nullptr, 0, nullptr);
@ -249,7 +250,7 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
client->recv_buffer = nullptr;
// Invalid handshaker response check.
if (resp == nullptr) {
gpr_log(GPR_ERROR, "alts_tsi_utils_deserialize_response() failed");
LOG(ERROR) << "alts_tsi_utils_deserialize_response() failed";
handle_response_done(client, TSI_DATA_CORRUPTED,
"alts_tsi_utils_deserialize_response() failed",
nullptr, 0, nullptr);
@ -258,7 +259,7 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
const grpc_gcp_HandshakerStatus* resp_status =
grpc_gcp_HandshakerResp_status(resp);
if (resp_status == nullptr) {
gpr_log(GPR_ERROR, "No status in HandshakerResp");
LOG(ERROR) << "No status in HandshakerResp";
handle_response_done(client, TSI_DATA_CORRUPTED,
"No status in HandshakerResp", nullptr, 0, nullptr);
return;
@ -281,7 +282,7 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
tsi_result status =
alts_tsi_handshaker_result_create(resp, client->is_client, &result);
if (status != TSI_OK) {
gpr_log(GPR_ERROR, "alts_tsi_handshaker_result_create() failed");
LOG(ERROR) << "alts_tsi_handshaker_result_create() failed";
handle_response_done(client, status,
"alts_tsi_handshaker_result_create() failed",
nullptr, 0, nullptr);
@ -299,7 +300,7 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
if (details.size > 0) {
error = absl::StrCat("Status ", code, " from handshaker service: ",
absl::string_view(details.data, details.size));
gpr_log(GPR_ERROR, "%s", error.c_str());
LOG(ERROR) << error;
}
}
// TODO(apolcyn): consider short ciruiting handle_response_done and
@ -357,7 +358,7 @@ static tsi_result continue_make_grpc_call(alts_grpc_handshaker_client* client,
if (client->grpc_caller(client->call, ops, static_cast<size_t>(op - ops),
&client->on_handshaker_service_resp_recv) !=
GRPC_CALL_OK) {
gpr_log(GPR_ERROR, "Start batch operation failed");
LOG(ERROR) << "Start batch operation failed";
return TSI_INTERNAL_ERROR;
}
return TSI_OK;
@ -544,21 +545,21 @@ static grpc_byte_buffer* get_serialized_start_client(
static tsi_result handshaker_client_start_client(alts_handshaker_client* c) {
if (c == nullptr) {
gpr_log(GPR_ERROR, "client is nullptr in handshaker_client_start_client()");
LOG(ERROR) << "client is nullptr in handshaker_client_start_client()";
return TSI_INVALID_ARGUMENT;
}
grpc_byte_buffer* buffer = get_serialized_start_client(c);
alts_grpc_handshaker_client* client =
reinterpret_cast<alts_grpc_handshaker_client*>(c);
if (buffer == nullptr) {
gpr_log(GPR_ERROR, "get_serialized_start_client() failed");
LOG(ERROR) << "get_serialized_start_client() failed";
return TSI_INTERNAL_ERROR;
}
handshaker_client_send_buffer_destroy(client);
client->send_buffer = buffer;
tsi_result result = make_grpc_call(&client->base, true /* is_start */);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "make_grpc_call() failed");
LOG(ERROR) << "make_grpc_call() failed";
}
return result;
}
@ -603,21 +604,21 @@ static grpc_byte_buffer* get_serialized_start_server(
static tsi_result handshaker_client_start_server(alts_handshaker_client* c,
grpc_slice* bytes_received) {
if (c == nullptr || bytes_received == nullptr) {
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_client_start_server()");
LOG(ERROR) << "Invalid arguments to handshaker_client_start_server()";
return TSI_INVALID_ARGUMENT;
}
alts_grpc_handshaker_client* client =
reinterpret_cast<alts_grpc_handshaker_client*>(c);
grpc_byte_buffer* buffer = get_serialized_start_server(c, bytes_received);
if (buffer == nullptr) {
gpr_log(GPR_ERROR, "get_serialized_start_server() failed");
LOG(ERROR) << "get_serialized_start_server() failed";
return TSI_INTERNAL_ERROR;
}
handshaker_client_send_buffer_destroy(client);
client->send_buffer = buffer;
tsi_result result = make_grpc_call(&client->base, true /* is_start */);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "make_grpc_call() failed");
LOG(ERROR) << "make_grpc_call() failed";
}
return result;
}
@ -640,7 +641,7 @@ static grpc_byte_buffer* get_serialized_next(grpc_slice* bytes_received) {
static tsi_result handshaker_client_next(alts_handshaker_client* c,
grpc_slice* bytes_received) {
if (c == nullptr || bytes_received == nullptr) {
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_client_next()");
LOG(ERROR) << "Invalid arguments to handshaker_client_next()";
return TSI_INVALID_ARGUMENT;
}
alts_grpc_handshaker_client* client =
@ -649,14 +650,14 @@ static tsi_result handshaker_client_next(alts_handshaker_client* c,
client->recv_bytes = grpc_core::CSliceRef(*bytes_received);
grpc_byte_buffer* buffer = get_serialized_next(bytes_received);
if (buffer == nullptr) {
gpr_log(GPR_ERROR, "get_serialized_next() failed");
LOG(ERROR) << "get_serialized_next() failed";
return TSI_INTERNAL_ERROR;
}
handshaker_client_send_buffer_destroy(client);
client->send_buffer = buffer;
tsi_result result = make_grpc_call(&client->base, false /* is_start */);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "make_grpc_call() failed");
LOG(ERROR) << "make_grpc_call() failed";
}
return result;
}
@ -716,7 +717,7 @@ alts_handshaker_client* alts_grpc_handshaker_client_create(
void* user_data, alts_handshaker_client_vtable* vtable_for_testing,
bool is_client, size_t max_frame_size, std::string* error) {
if (channel == nullptr || handshaker_service_url == nullptr) {
gpr_log(GPR_ERROR, "Invalid arguments to alts_handshaker_client_create()");
LOG(ERROR) << "Invalid arguments to alts_handshaker_client_create()";
return nullptr;
}
alts_grpc_handshaker_client* client = new alts_grpc_handshaker_client();
@ -891,8 +892,7 @@ tsi_result alts_handshaker_client_start_client(alts_handshaker_client* client) {
client->vtable->client_start != nullptr) {
return client->vtable->client_start(client);
}
gpr_log(GPR_ERROR,
"client or client->vtable has not been initialized properly");
LOG(ERROR) << "client or client->vtable has not been initialized properly";
return TSI_INVALID_ARGUMENT;
}
@ -902,8 +902,7 @@ tsi_result alts_handshaker_client_start_server(alts_handshaker_client* client,
client->vtable->server_start != nullptr) {
return client->vtable->server_start(client, bytes_received);
}
gpr_log(GPR_ERROR,
"client or client->vtable has not been initialized properly");
LOG(ERROR) << "client or client->vtable has not been initialized properly";
return TSI_INVALID_ARGUMENT;
}
@ -913,8 +912,7 @@ tsi_result alts_handshaker_client_next(alts_handshaker_client* client,
client->vtable->next != nullptr) {
return client->vtable->next(client, bytes_received);
}
gpr_log(GPR_ERROR,
"client or client->vtable has not been initialized properly");
LOG(ERROR) << "client or client->vtable has not been initialized properly";
return TSI_INVALID_ARGUMENT;
}

@ -19,6 +19,7 @@
#include "src/core/tsi/alts/handshaker/alts_tsi_utils.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/support/port_platform.h>
@ -59,7 +60,7 @@ grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response(
grpc_core::CSliceUnref(slice);
grpc_byte_buffer_reader_destroy(&bbr);
if (resp == nullptr) {
gpr_log(GPR_ERROR, "grpc_gcp_handshaker_resp_decode() failed");
LOG(ERROR) << "grpc_gcp_handshaker_resp_decode() failed";
return nullptr;
}
return resp;

@ -18,6 +18,7 @@
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
#include "absl/log/log.h"
#include "upb/mem/arena.hpp"
#include <grpc/support/port_platform.h>
@ -100,7 +101,7 @@ bool grpc_gcp_rpc_protocol_versions_decode(
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(slice)),
GRPC_SLICE_LENGTH(slice), arena.ptr());
if (versions_msg == nullptr) {
gpr_log(GPR_ERROR, "cannot deserialize RpcProtocolVersions message");
LOG(ERROR) << "cannot deserialize RpcProtocolVersions message";
return false;
}
grpc_gcp_rpc_protocol_versions_assign_from_upb(versions, versions_msg);

@ -21,6 +21,7 @@
#include <string.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -69,7 +70,7 @@ static tsi_result alts_grpc_integrity_only_extra_copy_protect(
grpc_status_code status = alts_iovec_record_protocol_integrity_only_protect(
rp->iovec_rp, rp->iovec_buf, 1, header_iovec, tag_iovec, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to protect, %s", error_details);
LOG(ERROR) << "Failed to protect, " << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}
@ -109,7 +110,7 @@ static tsi_result alts_grpc_integrity_only_protect(
rp->iovec_rp, rp->iovec_buf, unprotected_slices->count, header_iovec,
tag_iovec, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to protect, %s", error_details);
LOG(ERROR) << "Failed to protect, " << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}
@ -132,7 +133,7 @@ static tsi_result alts_grpc_integrity_only_unprotect(
return TSI_INVALID_ARGUMENT;
}
if (protected_slices->length < rp->header_length + rp->tag_length) {
gpr_log(GPR_ERROR, "Protected slices do not have sufficient data.");
LOG(ERROR) << "Protected slices do not have sufficient data.";
return TSI_INVALID_ARGUMENT;
}
// In this method, rp points to alts_grpc_record_protocol struct
@ -171,7 +172,7 @@ static tsi_result alts_grpc_integrity_only_unprotect(
integrity_only_record_protocol->data_sb.count, header_iovec, tag_iovec,
&error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to unprotect, %s", error_details);
LOG(ERROR) << "Failed to unprotect, " << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}

@ -18,6 +18,8 @@
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -60,7 +62,7 @@ static tsi_result alts_grpc_privacy_integrity_protect(
rp->iovec_rp, rp->iovec_buf, unprotected_slices->count,
protected_iovec, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to protect, %s", error_details);
LOG(ERROR) << "Failed to protect, " << error_details;
gpr_free(error_details);
grpc_core::CSliceUnref(protected_slice);
return TSI_INTERNAL_ERROR;
@ -84,7 +86,7 @@ static tsi_result alts_grpc_privacy_integrity_unprotect(
// Allocates memory for output frame. In privacy-integrity unprotect, the
// unprotected data are stored in a newly allocated buffer.
if (protected_slices->length < rp->header_length + rp->tag_length) {
gpr_log(GPR_ERROR, "Protected slices do not have sufficient data.");
LOG(ERROR) << "Protected slices do not have sufficient data.";
return TSI_INVALID_ARGUMENT;
}
size_t unprotected_frame_size =
@ -105,7 +107,7 @@ static tsi_result alts_grpc_privacy_integrity_unprotect(
rp->iovec_rp, header_iovec, rp->iovec_buf, protected_slices->count,
unprotected_iovec, &error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to unprotect, %s", error_details);
LOG(ERROR) << "Failed to unprotect, " << error_details;
gpr_free(error_details);
grpc_core::CSliceUnref(unprotected_slice);
return TSI_INTERNAL_ERROR;

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -93,7 +94,7 @@ static bool read_frame_size(const grpc_slice_buffer* sb,
(static_cast<uint32_t>(frame_size_buffer[1]) << 8) |
static_cast<uint32_t>(frame_size_buffer[0]);
if (frame_size > kMaxFrameLength) {
gpr_log(GPR_ERROR, "Frame size is larger than maximum frame size");
LOG(ERROR) << "Frame size is larger than maximum frame size";
return false;
}
// Returns frame size including frame length field.
@ -124,7 +125,7 @@ static tsi_result create_alts_grpc_record_protocol(
kAesGcmTagLength, &crypter,
&error_details);
if (status != GRPC_STATUS_OK) {
gpr_log(GPR_ERROR, "Failed to create AEAD crypter, %s", error_details);
LOG(ERROR) << "Failed to create AEAD crypter, " << error_details;
gpr_free(error_details);
return TSI_INTERNAL_ERROR;
}
@ -153,7 +154,7 @@ static tsi_result alts_zero_copy_grpc_protector_protect(
grpc_slice_buffer* protected_slices) {
if (self == nullptr || unprotected_slices == nullptr ||
protected_slices == nullptr) {
gpr_log(GPR_ERROR, "Invalid nullptr arguments to zero-copy grpc protect.");
LOG(ERROR) << "Invalid nullptr arguments to zero-copy grpc protect.";
return TSI_INVALID_ARGUMENT;
}
alts_zero_copy_grpc_protector* protector =

@ -22,6 +22,7 @@
#include <string.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -31,7 +32,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/transport_security_grpc.h"
#include "src/core/util/useful.h"
#include "src/core/tsi/transport_security_interface.h"
// --- Constants. ---
#define TSI_FAKE_FRAME_HEADER_SIZE 4
@ -91,7 +92,7 @@ static const char* tsi_fake_handshake_message_strings[] = {
static const char* tsi_fake_handshake_message_to_string(int msg) {
if (msg < 0 || msg >= TSI_FAKE_HANDSHAKE_MESSAGE_MAX) {
gpr_log(GPR_ERROR, "Invalid message %d", msg);
LOG(ERROR) << "Invalid message " << msg;
return "UNKNOWN";
}
return tsi_fake_handshake_message_strings[msg];
@ -107,7 +108,7 @@ static tsi_result tsi_fake_handshake_message_from_string(
return TSI_OK;
}
}
gpr_log(GPR_ERROR, "Invalid handshake message.");
LOG(ERROR) << "Invalid handshake message.";
if (error != nullptr) *error = "invalid handshake message";
return TSI_DATA_CORRUPTED;
}
@ -312,8 +313,8 @@ static tsi_result fake_protector_protect(tsi_frame_protector* self,
result = tsi_fake_frame_decode(frame_header, &written_in_frame_size, frame,
/*error=*/nullptr);
if (result != TSI_INCOMPLETE_DATA) {
gpr_log(GPR_ERROR, "tsi_fake_frame_decode returned %s",
tsi_result_to_string(result));
LOG(ERROR) << "tsi_fake_frame_decode returned "
<< tsi_result_to_string(result);
return result;
}
}
@ -469,7 +470,7 @@ static tsi_result fake_zero_copy_grpc_protector_unprotect(
if (impl->parsed_frame_size == 0) {
impl->parsed_frame_size = read_frame_size(&impl->protected_sb);
if (impl->parsed_frame_size <= 4) {
gpr_log(GPR_ERROR, "Invalid frame size.");
LOG(ERROR) << "Invalid frame size.";
return TSI_DATA_CORRUPTED;
}
}
@ -653,7 +654,7 @@ static tsi_result fake_handshaker_get_bytes_to_send_to_peer(
impl->next_message_to_send == TSI_FAKE_HANDSHAKE_MESSAGE_MAX) {
// We're done.
if (GRPC_TRACE_FLAG_ENABLED(tsi_tracing_enabled)) {
gpr_log(GPR_INFO, "Server is done.");
LOG(INFO) << "Server is done.";
}
impl->result = TSI_OK;
} else {
@ -694,15 +695,15 @@ static tsi_result fake_handshaker_process_bytes_from_peer(
tsi_fake_handshake_message_to_string(expected_msg));
}
if (GRPC_TRACE_FLAG_ENABLED(tsi_tracing_enabled)) {
gpr_log(GPR_INFO, "%s received %s.", impl->is_client ? "Client" : "Server",
tsi_fake_handshake_message_to_string(received_msg));
LOG(INFO) << (impl->is_client ? "Client" : "Server") << " received "
<< tsi_fake_handshake_message_to_string(received_msg);
}
tsi_fake_frame_reset(&impl->incoming_frame, 0 /* needs_draining */);
impl->needs_incoming_message = 0;
if (impl->next_message_to_send == TSI_FAKE_HANDSHAKE_MESSAGE_MAX) {
// We're done.
if (GRPC_TRACE_FLAG_ENABLED(tsi_tracing_enabled)) {
gpr_log(GPR_INFO, "%s is done.", impl->is_client ? "Client" : "Server");
LOG(INFO) << (impl->is_client ? "Client" : "Server") << " is done.";
}
impl->result = TSI_OK;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save