Skip to content

Commit

Permalink
[Gpr_To_Absl_Logging] Remove gpr_should_log from the header file (grp…
Browse files Browse the repository at this point in the history
…c#37420)

[Gpr_To_Absl_Logging] Remove gpr_should_log from the header file

Closes grpc#37420

COPYBARA_INTEGRATE_REVIEW=grpc#37420 from tanvi-jagtap:clean_up_ruby_php_01 ce303fa
PiperOrigin-RevId: 661118631
  • Loading branch information
tanvi-jagtap authored and copybara-github committed Aug 9, 2024
1 parent 8fe72e4 commit 83b5620
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion grpc.def

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion include/grpc/support/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ 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);

GPRAPI int gpr_should_log(gpr_log_severity severity);
/** Deprecated. **/
GPRAPI int absl_vlog2_enabled();

GPRAPI void gpr_log_verbosity_init(void);

Expand Down
2 changes: 1 addition & 1 deletion src/core/ext/transport/binder/wire_format/wire_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void WireWriterImpl::TryScheduleTransaction() {
} else {
// It is common to fill `kFlowControlWindowSize` completely because
// transactions are send at faster rate than the other end of transport
// can handle it, so here we use `GPR_DEBUG` log level.
// can handle it, so here we use VLOG(2).
VLOG(2) << "Some work cannot be scheduled yet due to slow ack from the "
"other end of transport. This transport might be blocked if "
"this number don't go down. pending_outgoing_tx_.size() = "
Expand Down
1 change: 1 addition & 0 deletions src/core/util/android/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "src/core/lib/gprpp/crash.h"

extern int gpr_should_log(gpr_log_severity severity);
extern void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message);

Expand Down
1 change: 1 addition & 0 deletions src/core/util/linux/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/examine_stack.h"

extern int gpr_should_log(gpr_log_severity severity);
extern void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message);

Expand Down
2 changes: 2 additions & 0 deletions src/core/util/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ 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:
Expand Down
1 change: 1 addition & 0 deletions src/core/util/posix/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/examine_stack.h"

extern int gpr_should_log(gpr_log_severity severity);
extern void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message);

Expand Down
1 change: 1 addition & 0 deletions src/core/util/windows/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "src/core/lib/gprpp/examine_stack.h"
#include "src/core/util/string.h"

extern int gpr_should_log(gpr_log_severity severity);
extern void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message);

Expand Down
2 changes: 1 addition & 1 deletion src/ruby/ext/grpc/rb_call_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ 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 (gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
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 =
Expand Down
4 changes: 2 additions & 2 deletions src/ruby/ext/grpc/rb_grpc_imports.generated.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/ruby/ext/grpc/rb_grpc_imports.generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions tools/run_tests/sanity/banned_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@

# 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",
Expand All @@ -63,13 +68,11 @@
"./src/ruby/ext/grpc/rb_server.c",
],
"gpr_should_log(": [
"./include/grpc/support/log.h",
"./src/core/util/android/log.cc",
"./src/core/util/linux/log.cc",
"./src/core/util/log.cc",
"./src/core/util/posix/log.cc",
"./src/core/util/windows/log.cc",
"./src/ruby/ext/grpc/rb_call_credentials.c",
],
"gpr_log_message(": [
"./src/core/util/android/log.cc",
Expand Down

0 comments on commit 83b5620

Please sign in to comment.