[Gpr_To_Absl_Logging] Replace gpr_should_log with absl::MinLogLevel() (#36870)

[Gpr_To_Absl_Logging] Replace gpr_should_log with absl::MinLogLevel()

Closes #36870

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36870 from tanvi-jagtap:fix_tcp_windows_gpr_should_log_01 a04c0106b7
PiperOrigin-RevId: 642443074
This commit is contained in:
Tanvi Jagtap 2024-06-11 17:20:09 -07:00 committed by Copybara-Service
parent 301bb28782
commit ccfc163607
2 changed files with 7 additions and 5 deletions

View File

@ -4870,6 +4870,7 @@ grpc_cc_library(
"absl/container:inlined_vector",
"absl/functional:function_ref",
"absl/log:check",
"absl/log:globals",
"absl/log:log",
"absl/status",
"absl/status:statusor",

View File

@ -73,6 +73,8 @@
#include "absl/container/inlined_vector.h"
#include "absl/functional/function_ref.h"
#include "absl/log/check.h"
#include "absl/log/globals.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -1162,13 +1164,12 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked() {
upb::Arena arena;
if (!GrpcLbResponseParse(response_slice, arena.ptr(), &response) ||
(response.type == response.INITIAL && seen_initial_response_)) {
if (gpr_should_log(GPR_LOG_SEVERITY_ERROR)) {
if (absl::MinLogLevel() <= absl::LogSeverityAtLeast::kError) {
char* response_slice_str =
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX);
gpr_log(GPR_ERROR,
"[grpclb %p] lb_calld=%p: Invalid LB response received: '%s'. "
"Ignoring.",
grpclb_policy(), this, response_slice_str);
LOG(ERROR) << "[grpclb " << grpclb_policy() << "] lb_calld=" << this
<< ": Invalid LB response received: '" << response_slice_str
<< "'. Ignoring.";
gpr_free(response_slice_str);
}
} else {