[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36359)

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36359

PiperOrigin-RevId: 625183028
pull/36355/head^2
Tanvi Jagtap 7 months ago committed by Copybara-Service
parent 8a6a02ff4d
commit 38fd697579
  1. 1
      examples/cpp/csm/BUILD
  2. 3
      examples/cpp/csm/csm_greeter_server.cc
  3. 1
      examples/cpp/helloworld/BUILD
  4. 1
      examples/cpp/helloworld/CMakeLists.txt
  5. 8
      examples/cpp/helloworld/xds_greeter_server.cc
  6. 1
      examples/cpp/xds/BUILD
  7. 8
      examples/cpp/xds/xds_greeter_server.cc

@ -41,6 +41,7 @@ cc_binary(
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log",
"@io_opentelemetry_cpp//exporters/prometheus:prometheus_exporter",
"@io_opentelemetry_cpp//sdk/src/metrics",
],

@ -22,6 +22,7 @@
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "opentelemetry/exporters/prometheus/exporter_factory.h"
#include "opentelemetry/exporters/prometheus/exporter_options.h"
@ -91,7 +92,7 @@ void RunServer(const char* hostname) {
xds_builder.AddListeningPort(absl::StrCat("0.0.0.0:", port),
grpc::InsecureServerCredentials());
xds_enabled_server = xds_builder.BuildAndStart();
gpr_log(GPR_INFO, "Server starting on 0.0.0.0:%d", port);
LOG(INFO) << "Server starting on 0.0.0.0:" << port;
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.

@ -129,5 +129,6 @@ cc_binary(
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log",
],
)

@ -68,6 +68,7 @@ foreach(_target
absl::check
absl::flags
absl::flags_parse
absl::log
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})

@ -22,6 +22,7 @@
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpcpp/ext/admin_services.h>
@ -79,21 +80,20 @@ void RunServer() {
absl::StrCat("0.0.0.0:", port),
grpc::XdsServerCredentials(grpc::InsecureServerCredentials()));
xds_enabled_server = xds_builder.BuildAndStart();
gpr_log(GPR_INFO, "Server starting on 0.0.0.0:%d", port);
LOG(INFO) << "Server starting on 0.0.0.0:" << port;
grpc::AddAdminServices(&builder);
// For the maintenance server, do not use any authentication mechanism.
builder.AddListeningPort(absl::StrCat("0.0.0.0:", maintenance_port),
grpc::InsecureServerCredentials());
server = builder.BuildAndStart();
gpr_log(GPR_INFO, "Maintenance server listening on 0.0.0.0:%d",
maintenance_port);
LOG(INFO) << "Maintenance server listening on 0.0.0.0:" << maintenance_port;
} else {
grpc::AddAdminServices(&xds_builder);
// Listen on the given address without any authentication mechanism.
builder.AddListeningPort(absl::StrCat("0.0.0.0:", port),
grpc::InsecureServerCredentials());
server = xds_builder.BuildAndStart();
gpr_log(GPR_INFO, "Server listening on 0.0.0.0:%d", port);
LOG(INFO) << "Server listening on 0.0.0.0:" << port;
}
// Wait for the server to shutdown. Note that some other thread must be

@ -37,5 +37,6 @@ cc_binary(
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log",
],
)

@ -22,6 +22,7 @@
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include <grpcpp/ext/admin_services.h>
@ -84,21 +85,20 @@ void RunServer() {
absl::StrCat("0.0.0.0:", port),
grpc::XdsServerCredentials(grpc::InsecureServerCredentials()));
xds_enabled_server = xds_builder.BuildAndStart();
gpr_log(GPR_INFO, "Server starting on 0.0.0.0:%d", port);
LOG(INFO) << "Server starting on 0.0.0.0:" << port;
grpc::AddAdminServices(&builder);
// For the maintenance server, do not use any authentication mechanism.
builder.AddListeningPort(absl::StrCat("0.0.0.0:", maintenance_port),
grpc::InsecureServerCredentials());
server = builder.BuildAndStart();
gpr_log(GPR_INFO, "Maintenance server listening on 0.0.0.0:%d",
maintenance_port);
LOG(INFO) << "Maintenance server listening on 0.0.0.0:" << maintenance_port;
} else {
grpc::AddAdminServices(&xds_builder);
// Listen on the given address without any authentication mechanism.
builder.AddListeningPort(absl::StrCat("0.0.0.0:", port),
grpc::InsecureServerCredentials());
server = xds_builder.BuildAndStart();
gpr_log(GPR_INFO, "Server listening on 0.0.0.0:%d", port);
LOG(INFO) << "Server listening on 0.0.0.0:" << port;
}
// Wait for the server to shutdown. Note that some other thread must be

Loading…
Cancel
Save