[Gpr_To_Absl_Logging] Removing absl_vlog2_enabled (#37476)

[Gpr_To_Absl_Logging] Removing absl_vlog2_enabled .

@apolcyn : Please review the Ruby code.

@yashykt : Please review the C++ code. And the python sanity test.

Closes #37476

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37476 from tanvi-jagtap:remove_should_fn c05fd6445e
PiperOrigin-RevId: 663193927
pull/37497/head^2
Tanvi Jagtap 4 months ago committed by Copybara-Service
parent 246e7d6436
commit d427a5c3b4
  1. 1
      grpc.def
  2. 3
      include/grpc/support/log.h
  3. 2
      src/core/util/log.cc
  4. 46
      src/ruby/ext/grpc/rb_call_credentials.c
  5. 2
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  6. 3
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  7. 5
      tools/run_tests/sanity/banned_functions.py

1
grpc.def generated

@ -231,7 +231,6 @@ EXPORTS
gpr_cpu_num_cores
gpr_cpu_current_cpu
gpr_log
absl_vlog2_enabled
gpr_log_verbosity_init
gpr_format_message
gpr_strdup

@ -51,9 +51,6 @@ typedef enum gpr_log_severity {
GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
/** Deprecated. **/
GPRAPI int absl_vlog2_enabled();
GPRAPI void gpr_log_verbosity_init(void);
#ifdef __cplusplus

@ -40,8 +40,6 @@ void gpr_unreachable_code(const char* reason, const char* file, int line) {
grpc_core::SourceLocation(file, line));
}
int absl_vlog2_enabled() { return ABSL_VLOG_IS_ON(2); }
int gpr_should_log(gpr_log_severity severity) {
switch (severity) {
case GPR_LOG_SEVERITY_ERROR:

@ -60,30 +60,30 @@ static VALUE grpc_rb_call_credentials_callback(VALUE args) {
VALUE callback_func = rb_ary_entry(args, 0);
VALUE callback_args = rb_ary_entry(args, 1);
VALUE md_ary_obj = rb_ary_entry(args, 2);
if (absl_vlog2_enabled()) {
VALUE callback_func_str = rb_funcall(callback_func, rb_intern("to_s"), 0);
VALUE callback_args_str = rb_funcall(callback_args, rb_intern("to_s"), 0);
VALUE callback_source_info =
rb_funcall(callback_func, rb_intern("source_location"), 0);
if (callback_source_info != Qnil) {
VALUE source_filename = rb_ary_entry(callback_source_info, 0);
VALUE source_line_number = rb_funcall(
rb_ary_entry(callback_source_info, 1), rb_intern("to_s"), 0);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
"source_filename:%s line_number:%s with arguments:|%s|",
StringValueCStr(callback_func_str),
StringValueCStr(source_filename),
StringValueCStr(source_line_number),
StringValueCStr(callback_args_str));
} else {
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
"(failed to get source filename and line) with arguments:|%s|",
StringValueCStr(callback_func_str),
StringValueCStr(callback_args_str));
}
VALUE callback_func_str = rb_funcall(callback_func, rb_intern("to_s"), 0);
VALUE callback_args_str = rb_funcall(callback_args, rb_intern("to_s"), 0);
VALUE callback_source_info =
rb_funcall(callback_func, rb_intern("source_location"), 0);
if (callback_source_info != Qnil) {
VALUE source_filename = rb_ary_entry(callback_source_info, 0);
VALUE source_line_number =
rb_funcall(rb_ary_entry(callback_source_info, 1), rb_intern("to_s"), 0);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
"source_filename:%s line_number:%s with arguments:|%s|",
StringValueCStr(callback_func_str),
StringValueCStr(source_filename),
StringValueCStr(source_line_number),
StringValueCStr(callback_args_str));
} else {
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_rb_call_credentials invoking user callback:|%s| "
"(failed to get source filename and line) with arguments:|%s|",
StringValueCStr(callback_func_str),
StringValueCStr(callback_args_str));
}
VALUE metadata =
rb_funcall(callback_func, rb_intern("call"), 1, callback_args);
grpc_metadata_array* md_ary = NULL;

@ -254,7 +254,6 @@ gpr_free_aligned_type gpr_free_aligned_import;
gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
gpr_log_type gpr_log_import;
absl_vlog2_enabled_type absl_vlog2_enabled_import;
gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
gpr_format_message_type gpr_format_message_import;
gpr_strdup_type gpr_strdup_import;
@ -539,7 +538,6 @@ void grpc_rb_load_imports(HMODULE library) {
gpr_cpu_num_cores_import = (gpr_cpu_num_cores_type) GetProcAddress(library, "gpr_cpu_num_cores");
gpr_cpu_current_cpu_import = (gpr_cpu_current_cpu_type) GetProcAddress(library, "gpr_cpu_current_cpu");
gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log");
absl_vlog2_enabled_import = (absl_vlog2_enabled_type) GetProcAddress(library, "absl_vlog2_enabled");
gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init");
gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message");
gpr_strdup_import = (gpr_strdup_type) GetProcAddress(library, "gpr_strdup");

@ -738,9 +738,6 @@ extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
typedef void(*gpr_log_type)(const char* file, int line, gpr_log_severity severity, const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
extern gpr_log_type gpr_log_import;
#define gpr_log gpr_log_import
typedef int(*absl_vlog2_enabled_type)();
extern absl_vlog2_enabled_type absl_vlog2_enabled_import;
#define absl_vlog2_enabled absl_vlog2_enabled_import
typedef void(*gpr_log_verbosity_init_type)(void);
extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
#define gpr_log_verbosity_init gpr_log_verbosity_init_import

@ -37,11 +37,6 @@ os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "../../.."))
# Map of deprecated functions to allowlist files
DEPRECATED_FUNCTION_TEMP_ALLOW_LIST = {
"absl_vlog2_enabled(": [
"./include/grpc/support/log.h",
"./src/core/util/log.cc",
"./src/ruby/ext/grpc/rb_call_credentials.c",
],
"gpr_log_severity": [
"./include/grpc/support/log.h",
"./src/core/util/android/log.cc",

Loading…
Cancel
Save