[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log

pull/36980/head
tanvi-jagtap 7 months ago
parent 5dc16b5f9e
commit 19ed6234f4
  1. 3
      src/core/lib/debug/trace.cc
  2. 28
      src/core/lib/experiments/config.cc
  3. 1
      tools/run_tests/sanity/banned_functions.py

@ -30,7 +30,6 @@
#include "absl/strings/strip.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/config/config_vars.h"
@ -41,7 +40,7 @@ int grpc_tracer_set_enabled(const char* name, int enabled);
namespace grpc_core {
namespace {
void LogAllTracers() {
gpr_log(GPR_DEBUG, "available tracers:");
VLOG(2) << "available tracers:";
for (const auto& name : GetAllTraceFlags()) {
LOG(INFO) << " " << name.first;
}

@ -24,12 +24,12 @@
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/config/config_vars.h"
@ -137,8 +137,7 @@ GPR_ATTRIBUTE_NOINLINE Experiments LoadExperimentsFromConfigVariableInner() {
// If not found log an error, but don't take any other action.
// Allows us an easy path to disabling experiments.
if (!found) {
gpr_log(GPR_ERROR, "Unknown experiment: %s",
std::string(experiment).c_str());
LOG(ERROR) << "Unknown experiment: " << experiment;
}
}
for (size_t i = 0; i < kNumExperiments; i++) {
@ -227,19 +226,20 @@ void PrintExperimentsList() {
}
if (experiment_status.empty()) {
if (!defaulted_on_experiments.empty()) {
gpr_log(GPR_INFO, "gRPC experiments enabled: %s",
absl::StrJoin(defaulted_on_experiments, ", ").c_str());
LOG(INFO) << "gRPC experiments enabled: "
<< absl::StrJoin(defaulted_on_experiments, ", ");
}
} else {
if (defaulted_on_experiments.empty()) {
gpr_log(GPR_INFO, "gRPC experiments: %s",
absl::StrJoin(experiment_status, ", ", absl::PairFormatter(":"))
.c_str());
LOG(INFO) << "gRPC experiments: "
<< absl::StrJoin(experiment_status, ", ",
absl::PairFormatter(":"));
} else {
gpr_log(GPR_INFO, "gRPC experiments: %s; default-enabled: %s",
absl::StrJoin(experiment_status, ", ", absl::PairFormatter(":"))
.c_str(),
absl::StrJoin(defaulted_on_experiments, ", ").c_str());
LOG(INFO) << "gRPC experiments: "
<< absl::StrJoin(experiment_status, ", ",
absl::PairFormatter(":"))
<< "; default-enabled: "
<< absl::StrJoin(defaulted_on_experiments, ", ");
}
}
}
@ -256,8 +256,8 @@ void ForceEnableExperiment(absl::string_view experiment, bool enable) {
}
return;
}
gpr_log(GPR_INFO, "gRPC EXPERIMENT %s not found to force %s",
std::string(experiment).c_str(), enable ? "enable" : "disable");
LOG(INFO) << "gRPC EXPERIMENT " << experiment << " not found to force "
<< (enable ? "enable" : "disable");
}
void RegisterExperimentConstraintsValidator(

@ -95,7 +95,6 @@ BANNED_EXCEPT = {
"./src/core/handshaker/http_connect/http_proxy_mapper.cc",
"./src/core/handshaker/security/secure_endpoint.cc",
"./src/core/lib/channel/channel_stack.cc",
"./src/core/lib/debug/trace.cc",
"./src/core/lib/event_engine/ares_resolver.h",
"./src/core/lib/event_engine/cf_engine/cf_engine.cc",
"./src/core/lib/event_engine/posix_engine/posix_engine.cc",

Loading…
Cancel
Save