diff --git a/examples/cpp/csm/BUILD b/examples/cpp/csm/BUILD index 836abbab310..7f1bf30d836 100644 --- a/examples/cpp/csm/BUILD +++ b/examples/cpp/csm/BUILD @@ -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", ], diff --git a/examples/cpp/csm/csm_greeter_server.cc b/examples/cpp/csm/csm_greeter_server.cc index c5d7857e7fa..910e3f65749 100644 --- a/examples/cpp/csm/csm_greeter_server.cc +++ b/examples/cpp/csm/csm_greeter_server.cc @@ -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. diff --git a/examples/cpp/helloworld/BUILD b/examples/cpp/helloworld/BUILD index 3c01b6ce1c3..1bcee389efb 100644 --- a/examples/cpp/helloworld/BUILD +++ b/examples/cpp/helloworld/BUILD @@ -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", ], ) diff --git a/examples/cpp/helloworld/CMakeLists.txt b/examples/cpp/helloworld/CMakeLists.txt index 73ad4877483..defe3064b14 100644 --- a/examples/cpp/helloworld/CMakeLists.txt +++ b/examples/cpp/helloworld/CMakeLists.txt @@ -68,6 +68,7 @@ foreach(_target absl::check absl::flags absl::flags_parse + absl::log ${_REFLECTION} ${_GRPC_GRPCPP} ${_PROTOBUF_LIBPROTOBUF}) diff --git a/examples/cpp/helloworld/xds_greeter_server.cc b/examples/cpp/helloworld/xds_greeter_server.cc index 9e4ca2a0549..c0bed68ff7a 100644 --- a/examples/cpp/helloworld/xds_greeter_server.cc +++ b/examples/cpp/helloworld/xds_greeter_server.cc @@ -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 @@ -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 diff --git a/examples/cpp/xds/BUILD b/examples/cpp/xds/BUILD index 6657b1cbbf6..bf5abfd1807 100644 --- a/examples/cpp/xds/BUILD +++ b/examples/cpp/xds/BUILD @@ -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", ], ) diff --git a/examples/cpp/xds/xds_greeter_server.cc b/examples/cpp/xds/xds_greeter_server.cc index bc4fe66c0f5..c35166c819e 100644 --- a/examples/cpp/xds/xds_greeter_server.cc +++ b/examples/cpp/xds/xds_greeter_server.cc @@ -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 @@ -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