[Gpr_To_Absl_Logging] Remove gpr_log. Adding absl LOG wrappers. (#37431)

[Gpr_To_Absl_Logging] Remove gpr_log. Adding absl LOG wrappers

List of changes in this PR

1. Replacing all instances of gpr_log in PHP and RUBY with the new absl wrapper APIs. The replacement mapping is given below

gpr_log(GPR_ERROR, ...)
	=> grpc_absl_log_error

gpr_log(GPR_INFO, ...)
	=> grpc_absl_log_info - Printing a simple message
	=> grpc_absl_log_info_int - Printing a message and a number
	=> grpc_absl_log_info_str - Printing 2 strings.

gpr_log(GPR_DEBUG, ...)
	=> grpc_absl_vlog - Printing a simple message
	=> grpc_absl_vlog_int - Printing a message and a number
	=> grpc_absl_vlog_str - Printing 2 strings.

Adding grpc_absl_vlog2_enabled() check around gpr_log(GPR_DEBUG, ...)

2. src/python/grpcio_observability/grpc_observability/observability_util.cc One instance of gpr_log to absl LOG replacement was missed earlier. Fixing that.

3. Deleting deprecated gpr stuff : gpr_log_severity , GPR_DEBUG , GPR_INFO , GPR_ERROR , gpr_log .

4. Adding new APIs for Ruby and PHP. These APIs are very simple wrappers around absl.

5. Removing the legacy functions in platform specific log.cc files. These files are safe to delete now.

6. Fixing the allow list in banned_functions.py . This makes sure that these new wrappers don't get used all over the place by everyone. We carefully only allow list the PHP and RUBY files and allow the use of these wrappers. Everywhere else - using these wrappers should fail Sanity Tests.

Closes #37431

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37431 from tanvi-jagtap:remove_gpr_error 6e5e9bcfcc
PiperOrigin-RevId: 668586873
pull/37597/head
Tanvi Jagtap 7 months ago committed by Copybara-Service
parent 2d99ca4e0b
commit 245941e0da
  1. 4
      BUILD
  2. 4
      CMakeLists.txt
  3. 4
      Makefile
  4. 4
      Package.swift
  5. 4
      build_autogenerated.yaml
  6. 5
      config.m4
  7. 5
      config.w32
  8. 4
      gRPC-Core.podspec
  9. 4
      grpc.def
  10. 4
      grpc.gemspec
  11. 37
      include/grpc/support/log.h
  12. 4
      package.xml
  13. 52
      src/core/util/android/log.cc
  14. 73
      src/core/util/linux/log.cc
  15. 61
      src/core/util/log.cc
  16. 73
      src/core/util/posix/log.cc
  17. 77
      src/core/util/windows/log.cc
  18. 4
      src/php/ext/grpc/call_credentials.c
  19. 16
      src/php/ext/grpc/channel.c
  20. 4
      src/python/grpcio/grpc_core_dependencies.py
  21. 4
      src/python/grpcio_observability/observability_lib_deps.py
  22. 2
      src/ruby/ext/grpc/rb_call.c
  23. 39
      src/ruby/ext/grpc/rb_call_credentials.c
  24. 38
      src/ruby/ext/grpc/rb_channel.c
  25. 5
      src/ruby/ext/grpc/rb_event_thread.c
  26. 17
      src/ruby/ext/grpc/rb_grpc.c
  27. 8
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  28. 12
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  29. 18
      src/ruby/ext/grpc/rb_server.c
  30. 4
      tools/doxygen/Doxyfile.c++.internal
  31. 4
      tools/doxygen/Doxyfile.core.internal
  32. 74
      tools/run_tests/sanity/banned_functions.py

@ -729,14 +729,11 @@ grpc_cc_library(
"//src/core:lib/gprpp/windows/stat.cc",
"//src/core:lib/gprpp/windows/thd.cc",
"//src/core:util/alloc.cc",
"//src/core:util/android/log.cc",
"//src/core:util/iphone/cpu.cc",
"//src/core:util/linux/cpu.cc",
"//src/core:util/linux/log.cc",
"//src/core:util/log.cc",
"//src/core:util/msys/tmpfile.cc",
"//src/core:util/posix/cpu.cc",
"//src/core:util/posix/log.cc",
"//src/core:util/posix/string.cc",
"//src/core:util/posix/sync.cc",
"//src/core:util/posix/time.cc",
@ -747,7 +744,6 @@ grpc_cc_library(
"//src/core:util/time.cc",
"//src/core:util/time_precise.cc",
"//src/core:util/windows/cpu.cc",
"//src/core:util/windows/log.cc",
"//src/core:util/windows/string.cc",
"//src/core:util/windows/string_util.cc",
"//src/core:util/windows/sync.cc",

4
CMakeLists.txt generated

@ -1702,15 +1702,12 @@ add_library(gpr
src/core/lib/gprpp/windows/stat.cc
src/core/lib/gprpp/windows/thd.cc
src/core/util/alloc.cc
src/core/util/android/log.cc
src/core/util/atm.cc
src/core/util/iphone/cpu.cc
src/core/util/linux/cpu.cc
src/core/util/linux/log.cc
src/core/util/log.cc
src/core/util/msys/tmpfile.cc
src/core/util/posix/cpu.cc
src/core/util/posix/log.cc
src/core/util/posix/string.cc
src/core/util/posix/sync.cc
src/core/util/posix/time.cc
@ -1721,7 +1718,6 @@ add_library(gpr
src/core/util/time.cc
src/core/util/time_precise.cc
src/core/util/windows/cpu.cc
src/core/util/windows/log.cc
src/core/util/windows/string.cc
src/core/util/windows/string_util.cc
src/core/util/windows/sync.cc

4
Makefile generated

@ -1452,7 +1452,6 @@ LIBGRPC_SRC = \
src/core/tsi/transport_security.cc \
src/core/tsi/transport_security_grpc.cc \
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/gcp_metadata_query.cc \
src/core/util/http_client/format_request.cc \
@ -1466,11 +1465,9 @@ LIBGRPC_SRC = \
src/core/util/json/json_writer.cc \
src/core/util/latent_see.cc \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
@ -1481,7 +1478,6 @@ LIBGRPC_SRC = \
src/core/util/time.cc \
src/core/util/time_precise.cc \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \

4
Package.swift generated

@ -1913,7 +1913,6 @@ let package = Package(
"src/core/tsi/transport_security_interface.h",
"src/core/util/alloc.cc",
"src/core/util/alloc.h",
"src/core/util/android/log.cc",
"src/core/util/atm.cc",
"src/core/util/gcp_metadata_query.cc",
"src/core/util/gcp_metadata_query.h",
@ -1940,11 +1939,9 @@ let package = Package(
"src/core/util/latent_see.cc",
"src/core/util/latent_see.h",
"src/core/util/linux/cpu.cc",
"src/core/util/linux/log.cc",
"src/core/util/log.cc",
"src/core/util/msys/tmpfile.cc",
"src/core/util/posix/cpu.cc",
"src/core/util/posix/log.cc",
"src/core/util/posix/string.cc",
"src/core/util/posix/sync.cc",
"src/core/util/posix/time.cc",
@ -1963,7 +1960,6 @@ let package = Package(
"src/core/util/upb_utils.h",
"src/core/util/useful.h",
"src/core/util/windows/cpu.cc",
"src/core/util/windows/log.cc",
"src/core/util/windows/string.cc",
"src/core/util/windows/string_util.cc",
"src/core/util/windows/sync.cc",

@ -97,15 +97,12 @@ libs:
- src/core/lib/gprpp/windows/stat.cc
- src/core/lib/gprpp/windows/thd.cc
- src/core/util/alloc.cc
- src/core/util/android/log.cc
- src/core/util/atm.cc
- src/core/util/iphone/cpu.cc
- src/core/util/linux/cpu.cc
- src/core/util/linux/log.cc
- src/core/util/log.cc
- src/core/util/msys/tmpfile.cc
- src/core/util/posix/cpu.cc
- src/core/util/posix/log.cc
- src/core/util/posix/string.cc
- src/core/util/posix/sync.cc
- src/core/util/posix/time.cc
@ -116,7 +113,6 @@ libs:
- src/core/util/time.cc
- src/core/util/time_precise.cc
- src/core/util/windows/cpu.cc
- src/core/util/windows/log.cc
- src/core/util/windows/string.cc
- src/core/util/windows/string_util.cc
- src/core/util/windows/sync.cc

5
config.m4 generated

@ -827,7 +827,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/tsi/transport_security.cc \
src/core/tsi/transport_security_grpc.cc \
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/gcp_metadata_query.cc \
src/core/util/http_client/format_request.cc \
@ -841,11 +840,9 @@ if test "$PHP_GRPC" != "no"; then
src/core/util/json/json_writer.cc \
src/core/util/latent_see.cc \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
@ -856,7 +853,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/util/time.cc \
src/core/util/time_precise.cc \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \
@ -1613,7 +1609,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/ssl/key_logging)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/ssl/session_cache)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/android)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/http_client)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/iphone)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/json)

5
config.w32 generated

@ -792,7 +792,6 @@ if (PHP_GRPC != "no") {
"src\\core\\tsi\\transport_security.cc " +
"src\\core\\tsi\\transport_security_grpc.cc " +
"src\\core\\util\\alloc.cc " +
"src\\core\\util\\android\\log.cc " +
"src\\core\\util\\atm.cc " +
"src\\core\\util\\gcp_metadata_query.cc " +
"src\\core\\util\\http_client\\format_request.cc " +
@ -806,11 +805,9 @@ if (PHP_GRPC != "no") {
"src\\core\\util\\json\\json_writer.cc " +
"src\\core\\util\\latent_see.cc " +
"src\\core\\util\\linux\\cpu.cc " +
"src\\core\\util\\linux\\log.cc " +
"src\\core\\util\\log.cc " +
"src\\core\\util\\msys\\tmpfile.cc " +
"src\\core\\util\\posix\\cpu.cc " +
"src\\core\\util\\posix\\log.cc " +
"src\\core\\util\\posix\\string.cc " +
"src\\core\\util\\posix\\sync.cc " +
"src\\core\\util\\posix\\time.cc " +
@ -821,7 +818,6 @@ if (PHP_GRPC != "no") {
"src\\core\\util\\time.cc " +
"src\\core\\util\\time_precise.cc " +
"src\\core\\util\\windows\\cpu.cc " +
"src\\core\\util\\windows\\log.cc " +
"src\\core\\util\\windows\\string.cc " +
"src\\core\\util\\windows\\string_util.cc " +
"src\\core\\util\\windows\\sync.cc " +
@ -1755,7 +1751,6 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\ssl\\key_logging");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\ssl\\session_cache");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\android");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\http_client");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\iphone");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\json");

4
gRPC-Core.podspec generated

@ -2029,7 +2029,6 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.cc',
'src/core/util/alloc.h',
'src/core/util/android/log.cc',
'src/core/util/atm.cc',
'src/core/util/gcp_metadata_query.cc',
'src/core/util/gcp_metadata_query.h',
@ -2056,11 +2055,9 @@ Pod::Spec.new do |s|
'src/core/util/latent_see.cc',
'src/core/util/latent_see.h',
'src/core/util/linux/cpu.cc',
'src/core/util/linux/log.cc',
'src/core/util/log.cc',
'src/core/util/msys/tmpfile.cc',
'src/core/util/posix/cpu.cc',
'src/core/util/posix/log.cc',
'src/core/util/posix/string.cc',
'src/core/util/posix/sync.cc',
'src/core/util/posix/time.cc',
@ -2079,7 +2076,6 @@ Pod::Spec.new do |s|
'src/core/util/upb_utils.h',
'src/core/util/useful.h',
'src/core/util/windows/cpu.cc',
'src/core/util/windows/log.cc',
'src/core/util/windows/string.cc',
'src/core/util/windows/string_util.cc',
'src/core/util/windows/sync.cc',

4
grpc.def generated

@ -230,7 +230,9 @@ EXPORTS
gpr_free_aligned
gpr_cpu_num_cores
gpr_cpu_current_cpu
gpr_log
grpc_absl_log
grpc_absl_log_int
grpc_absl_log_str
gpr_log_verbosity_init
gpr_format_message
gpr_strdup

4
grpc.gemspec generated

@ -1915,7 +1915,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/tsi/transport_security_interface.h )
s.files += %w( src/core/util/alloc.cc )
s.files += %w( src/core/util/alloc.h )
s.files += %w( src/core/util/android/log.cc )
s.files += %w( src/core/util/atm.cc )
s.files += %w( src/core/util/gcp_metadata_query.cc )
s.files += %w( src/core/util/gcp_metadata_query.h )
@ -1942,11 +1941,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/util/latent_see.cc )
s.files += %w( src/core/util/latent_see.h )
s.files += %w( src/core/util/linux/cpu.cc )
s.files += %w( src/core/util/linux/log.cc )
s.files += %w( src/core/util/log.cc )
s.files += %w( src/core/util/msys/tmpfile.cc )
s.files += %w( src/core/util/posix/cpu.cc )
s.files += %w( src/core/util/posix/log.cc )
s.files += %w( src/core/util/posix/string.cc )
s.files += %w( src/core/util/posix/sync.cc )
s.files += %w( src/core/util/posix/time.cc )
@ -1965,7 +1962,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/util/upb_utils.h )
s.files += %w( src/core/util/useful.h )
s.files += %w( src/core/util/windows/cpu.cc )
s.files += %w( src/core/util/windows/log.cc )
s.files += %w( src/core/util/windows/string.cc )
s.files += %w( src/core/util/windows/string_util.cc )
s.files += %w( src/core/util/windows/sync.cc )

@ -28,13 +28,8 @@
extern "C" {
#endif
/**
* Logging functions in this file are deprecated.
* Please use absl ABSL_LOG instead.
*/
/** The severity of a log message - use the #defines below when calling into
gpr_log to additionally supply file and line data */
grpc_absl_log to additionally supply file and line data */
typedef enum gpr_log_severity {
GPR_LOG_SEVERITY_DEBUG,
GPR_LOG_SEVERITY_INFO,
@ -46,10 +41,32 @@ typedef enum gpr_log_severity {
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
/** Log a message. It's advised to use GPR_xxx above to generate the context
* for each message */
GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* Equivalent to ABSL_LOG(severity) << message_str;
* **/
GPRAPI void grpc_absl_log(const char* file, int line, gpr_log_severity severity,
const char* message_str);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* Equivalent to ABSL_LOG(severity) << message_str << num;
* **/
GPRAPI void grpc_absl_log_int(const char* file, int line,
gpr_log_severity severity,
const char* message_str, intptr_t num);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* Equivalent to ABSL_LOG(severity) << message_str1 << message_str2;
* **/
GPRAPI void grpc_absl_log_str(const char* file, int line,
gpr_log_severity severity,
const char* message_str1,
const char* message_str2);
GPRAPI void gpr_log_verbosity_init(void);

4
package.xml generated

@ -1897,7 +1897,6 @@
<file baseinstalldir="/" name="src/core/tsi/transport_security_interface.h" role="src" />
<file baseinstalldir="/" name="src/core/util/alloc.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/alloc.h" role="src" />
<file baseinstalldir="/" name="src/core/util/android/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/atm.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/gcp_metadata_query.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/gcp_metadata_query.h" role="src" />
@ -1924,11 +1923,9 @@
<file baseinstalldir="/" name="src/core/util/latent_see.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/latent_see.h" role="src" />
<file baseinstalldir="/" name="src/core/util/linux/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/linux/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/msys/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/time.cc" role="src" />
@ -1947,7 +1944,6 @@
<file baseinstalldir="/" name="src/core/util/upb_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/util/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/string_util.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/sync.cc" role="src" />

@ -1,52 +0,0 @@
//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include <grpc/support/port_platform.h>
#ifdef GPR_ANDROID
#include <android/log.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#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);
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
// Avoid message construction if gpr_log_message won't log
if (gpr_should_log(severity) == 0) {
return;
}
char* message = NULL;
va_list args;
va_start(args, format);
vasprintf(&message, format, args);
va_end(args);
gpr_log_message(file, line, severity, message);
free(message);
}
#endif // GPR_ANDROID

@ -1,73 +0,0 @@
//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <grpc/support/port_platform.h>
#ifdef GPR_LINUX_LOG
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
#include <string>
#include "absl/strings/str_format.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#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);
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
// Avoid message construction if gpr_log_message won't log
if (gpr_should_log(severity) == 0) {
return;
}
char* message = nullptr;
va_list args;
va_start(args, format);
if (vasprintf(&message, format, args) == -1) {
va_end(args);
return;
}
va_end(args);
gpr_log_message(file, line, severity, message);
// message has been allocated by vasprintf above, and needs free
free(message);
}
#endif // GPR_LINUX_LOG

@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include "absl/log/check.h"
#include "absl/log/globals.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
@ -40,45 +41,57 @@ void gpr_unreachable_code(const char* reason, const char* file, int line) {
grpc_core::SourceLocation(file, line));
}
int gpr_should_log(gpr_log_severity severity) {
GPRAPI void grpc_absl_log(const char* file, int line, gpr_log_severity severity,
const char* message_str) {
switch (severity) {
case GPR_LOG_SEVERITY_ERROR:
return absl::MinLogLevel() <= absl::LogSeverityAtLeast::kError;
case GPR_LOG_SEVERITY_INFO:
// There is no documentation about how expensive or inexpensive
// MinLogLevel is. We could have saved this in a static const variable.
// But decided against it just in case anyone programatically sets absl
// min log level settings after this has been initialized.
// Same holds for ABSL_VLOG_IS_ON(2).
return absl::MinLogLevel() <= absl::LogSeverityAtLeast::kInfo;
case GPR_LOG_SEVERITY_DEBUG:
return ABSL_VLOG_IS_ON(2);
VLOG(2).AtLocation(file, line) << message_str;
return;
case GPR_LOG_SEVERITY_INFO:
LOG(INFO).AtLocation(file, line) << message_str;
return;
case GPR_LOG_SEVERITY_ERROR:
LOG(ERROR).AtLocation(file, line) << message_str;
return;
default:
DLOG(ERROR) << "Invalid gpr_log_severity.";
return true;
DCHECK(false) << "Invalid severity";
}
}
void gpr_log_message(const char* file, int line, gpr_log_severity severity,
const char* message) {
if (gpr_should_log(severity) == 0) {
return;
GPRAPI void grpc_absl_log_int(const char* file, int line,
gpr_log_severity severity,
const char* message_str, intptr_t num) {
switch (severity) {
case GPR_LOG_SEVERITY_DEBUG:
VLOG(2).AtLocation(file, line) << message_str << num;
return;
case GPR_LOG_SEVERITY_INFO:
LOG(INFO).AtLocation(file, line) << message_str << num;
return;
case GPR_LOG_SEVERITY_ERROR:
LOG(ERROR).AtLocation(file, line) << message_str << num;
return;
default:
DCHECK(false) << "Invalid severity";
}
}
GPRAPI void grpc_absl_log_str(const char* file, int line,
gpr_log_severity severity,
const char* message_str1,
const char* message_str2) {
switch (severity) {
case GPR_LOG_SEVERITY_DEBUG:
// Log DEBUG messages as VLOG(2).
VLOG(2).AtLocation(file, line) << message;
VLOG(2).AtLocation(file, line) << message_str1 << message_str2;
return;
case GPR_LOG_SEVERITY_INFO:
LOG(INFO).AtLocation(file, line) << message;
LOG(INFO).AtLocation(file, line) << message_str1 << message_str2;
return;
case GPR_LOG_SEVERITY_ERROR:
LOG(ERROR).AtLocation(file, line) << message;
LOG(ERROR).AtLocation(file, line) << message_str1 << message_str2;
return;
default:
LOG(ERROR) << __func__ << ": unknown gpr log severity(" << severity
<< "), using ERROR";
LOG(ERROR).AtLocation(file, line) << message;
DCHECK(false) << "Invalid severity";
}
}

@ -1,73 +0,0 @@
//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include <grpc/support/port_platform.h>
#ifdef GPR_POSIX_LOG
#include <inttypes.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <string>
#include "absl/strings/str_format.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#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);
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
// Avoid message construction if gpr_log_message won't log
if (gpr_should_log(severity) == 0) {
return;
}
char buf[64];
char* allocated = nullptr;
char* message = nullptr;
int ret;
va_list args;
va_start(args, format);
ret = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if (ret < 0) {
message = nullptr;
} else if ((size_t)ret <= sizeof(buf) - 1) {
message = buf;
} else {
message = allocated = (char*)gpr_malloc((size_t)ret + 1);
va_start(args, format);
vsnprintf(message, (size_t)(ret + 1), format, args);
va_end(args);
}
gpr_log_message(file, line, severity, message);
gpr_free(allocated);
}
#endif // defined(GPR_POSIX_LOG)

@ -1,77 +0,0 @@
//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include <grpc/support/port_platform.h>
#ifdef GPR_WINDOWS_LOG
#include <stdarg.h>
#include <stdio.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/lib/gprpp/crash.h"
#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);
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
// Avoid message construction if gpr_log_message won't log
if (gpr_should_log(severity) == 0) {
return;
}
char* message = NULL;
va_list args;
int ret;
// Determine the length.
va_start(args, format);
ret = _vscprintf(format, args);
va_end(args);
if (ret < 0) {
message = NULL;
} else {
// Allocate a new buffer, with space for the NUL terminator.
size_t strp_buflen = (size_t)ret + 1;
message = (char*)gpr_malloc(strp_buflen);
// Print to the buffer.
va_start(args, format);
ret = vsnprintf_s(message, strp_buflen, _TRUNCATE, format, args);
va_end(args);
if ((size_t)ret != strp_buflen - 1) {
// This should never happen.
gpr_free(message);
message = NULL;
}
}
gpr_log_message(file, line, severity, message);
gpr_free(message);
}
#endif // GPR_WINDOWS_LOG

@ -165,10 +165,10 @@ int plugin_get_metadata(
PHP_GRPC_DELREF(arg);
gpr_log(GPR_INFO, "GRPC_PHP: call credentials plugin function - begin");
grpc_absl_log(GPR_INFO, "GRPC_PHP: call credentials plugin function - begin");
/* call the user callback function */
zend_call_function(state->fci, state->fci_cache TSRMLS_CC);
gpr_log(GPR_INFO, "GRPC_PHP: call credentials plugin function - end");
grpc_absl_log(GPR_INFO, "GRPC_PHP: call credentials plugin function - end");
*num_creds_md = 0;
*status = GRPC_STATUS_OK;

@ -272,12 +272,16 @@ void create_and_add_channel_to_persistent_list(
// If no channel can be deleted from the persistent map,
// do not persist this one.
create_channel(channel, target, args, creds);
gpr_log(GPR_INFO, "[Warning] The number of channel for the"
" target %s is maxed out bounded.\n", target);
gpr_log(GPR_INFO, "[Warning] Target upper bound: %d. Current size: %d.\n",
target_bound_status->upper_bound,
target_bound_status->current_count);
gpr_log(GPR_INFO, "[Warning] Target %s will not be persisted.\n", target);
grpc_absl_log_str(GPR_INFO,
"[Warning] The number of channel for the target is maxed out bounded."
" Target will not be persisted. Target : ",
target);
grpc_absl_log_int(GPR_INFO,
"[Warning] Target upper bound: ",
target_bound_status->upper_bound);
grpc_absl_log_int(GPR_INFO,
"[Warning] Current size: ",
target_bound_status->current_count);
return;
}
}

@ -801,7 +801,6 @@ CORE_SOURCE_FILES = [
'src/core/tsi/transport_security.cc',
'src/core/tsi/transport_security_grpc.cc',
'src/core/util/alloc.cc',
'src/core/util/android/log.cc',
'src/core/util/atm.cc',
'src/core/util/gcp_metadata_query.cc',
'src/core/util/http_client/format_request.cc',
@ -815,11 +814,9 @@ CORE_SOURCE_FILES = [
'src/core/util/json/json_writer.cc',
'src/core/util/latent_see.cc',
'src/core/util/linux/cpu.cc',
'src/core/util/linux/log.cc',
'src/core/util/log.cc',
'src/core/util/msys/tmpfile.cc',
'src/core/util/posix/cpu.cc',
'src/core/util/posix/log.cc',
'src/core/util/posix/string.cc',
'src/core/util/posix/sync.cc',
'src/core/util/posix/time.cc',
@ -830,7 +827,6 @@ CORE_SOURCE_FILES = [
'src/core/util/time.cc',
'src/core/util/time_precise.cc',
'src/core/util/windows/cpu.cc',
'src/core/util/windows/log.cc',
'src/core/util/windows/string.cc',
'src/core/util/windows/string_util.cc',
'src/core/util/windows/sync.cc',

@ -43,15 +43,12 @@ CC_FILES=[
'grpc_root/src/core/lib/slice/slice.cc',
'grpc_root/src/core/lib/slice/slice_string_helpers.cc',
'grpc_root/src/core/util/alloc.cc',
'grpc_root/src/core/util/android/log.cc',
'grpc_root/src/core/util/atm.cc',
'grpc_root/src/core/util/iphone/cpu.cc',
'grpc_root/src/core/util/linux/cpu.cc',
'grpc_root/src/core/util/linux/log.cc',
'grpc_root/src/core/util/log.cc',
'grpc_root/src/core/util/msys/tmpfile.cc',
'grpc_root/src/core/util/posix/cpu.cc',
'grpc_root/src/core/util/posix/log.cc',
'grpc_root/src/core/util/posix/string.cc',
'grpc_root/src/core/util/posix/sync.cc',
'grpc_root/src/core/util/posix/time.cc',
@ -62,7 +59,6 @@ CC_FILES=[
'grpc_root/src/core/util/time.cc',
'grpc_root/src/core/util/time_precise.cc',
'grpc_root/src/core/util/windows/cpu.cc',
'grpc_root/src/core/util/windows/log.cc',
'grpc_root/src/core/util/windows/string.cc',
'grpc_root/src/core/util/windows/string_util.cc',
'grpc_root/src/core/util/windows/sync.cc',

@ -809,7 +809,7 @@ struct call_run_batch_args {
};
static void cancel_call_unblock_func(void* arg) {
gpr_log(GPR_DEBUG, "GRPC_RUBY: cancel_call_unblock_func");
grpc_absl_log(GPR_DEBUG, "GRPC_RUBY: cancel_call_unblock_func");
grpc_call* call = (grpc_call*)arg;
grpc_call_cancel(call, NULL);
}

@ -65,23 +65,25 @@ static VALUE grpc_rb_call_credentials_callback(VALUE args) {
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);
grpc_absl_log_str(
GPR_DEBUG, "GRPC_RUBY: grpc_rb_call_credentials invoking user callback:",
StringValueCStr(callback_func_str));
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));
grpc_absl_log_str(GPR_DEBUG, "GRPC_RUBY: source_filename: ",
StringValueCStr(source_filename));
grpc_absl_log_str(GPR_DEBUG, "GRPC_RUBY: source_line_number: ",
StringValueCStr(source_line_number));
grpc_absl_log_str(GPR_DEBUG, "GRPC_RUBY: Arguments: ",
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));
grpc_absl_log_str(
GPR_DEBUG, "(failed to get source filename and line) with arguments: ",
StringValueCStr(callback_args_str));
}
VALUE metadata =
@ -112,10 +114,15 @@ static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
VALUE rb_exception_info =
rb_funcall(exception_object, rb_intern("inspect"), 0);
(void)args;
gpr_log(GPR_DEBUG,
"GRPC_RUBY call credentials callback failed, exception inspect:|%s| "
"backtrace:|%s|",
StringValueCStr(rb_exception_info), StringValueCStr(backtrace_str));
grpc_absl_log_str(
GPR_DEBUG,
"GRPC_RUBY call credentials callback failed, exception inspect: ",
StringValueCStr(rb_exception_info));
grpc_absl_log_str(GPR_DEBUG,
"GRPC_RUBY call credentials callback failed, backtrace: ",
StringValueCStr(backtrace_str));
rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
rb_hash_aset(result, rb_str_new2("status"),
INT2NUM(GRPC_STATUS_UNAUTHENTICATED));

@ -655,7 +655,7 @@ static void* run_poll_channels_loop_no_gil(void* arg) {
watch_state_op* op = NULL;
bg_watched_channel* bg = NULL;
(void)arg;
gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_no_gil - begin");
grpc_absl_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_no_gil - begin");
gpr_mu_lock(&global_connection_polling_mu);
gpr_cv_broadcast(&global_connection_polling_cv);
@ -685,9 +685,10 @@ static void* run_poll_channels_loop_no_gil(void* arg) {
gpr_mu_unlock(&global_connection_polling_mu);
}
grpc_completion_queue_destroy(g_channel_polling_cq);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_no_gil - exit connection polling "
"loop");
grpc_absl_log(
GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_no_gil - exit connection polling "
"loop");
return NULL;
}
@ -701,9 +702,10 @@ static void* run_poll_channels_loop_unblocking_func_wrapper(void* arg) {
(void)arg;
gpr_mu_lock(&global_connection_polling_mu);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - begin aborting "
"connection polling");
grpc_absl_log(
GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - begin aborting "
"connection polling");
// early out after first time through
if (g_abort_channel_polling) {
gpr_mu_unlock(&global_connection_polling_mu);
@ -721,21 +723,23 @@ static void* run_poll_channels_loop_unblocking_func_wrapper(void* arg) {
bg = bg->next;
}
gpr_log(GPR_DEBUG, "GRPC_RUBY: cq shutdown on global polling cq. pid: %d",
getpid());
grpc_absl_log_int(
GPR_DEBUG,
"GRPC_RUBY: cq shutdown on global polling cq. pid: ", getpid());
grpc_completion_queue_shutdown(g_channel_polling_cq);
gpr_cv_broadcast(&global_connection_polling_cv);
gpr_mu_unlock(&global_connection_polling_mu);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - end aborting "
"connection polling");
grpc_absl_log(
GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - end aborting "
"connection polling");
return NULL;
}
// Poll channel connectivity states in background thread without the GIL.
static VALUE run_poll_channels_loop(void* arg) {
(void)arg;
gpr_log(
grpc_absl_log(
GPR_DEBUG,
"GRPC_RUBY: run_poll_channels_loop - create connection polling thread");
rb_thread_call_without_gvl(run_poll_channels_loop_no_gil, NULL,
@ -777,7 +781,8 @@ void grpc_rb_channel_polling_thread_start() {
g_channel_polling_thread = rb_thread_create(run_poll_channels_loop, NULL);
if (!RTEST(g_channel_polling_thread)) {
gpr_log(GPR_ERROR, "GRPC_RUBY: failed to spawn channel polling thread");
grpc_absl_log(GPR_ERROR,
"GRPC_RUBY: failed to spawn channel polling thread");
rb_thread_call_without_gvl(set_abort_channel_polling_without_gil, NULL,
NULL, NULL);
return;
@ -786,8 +791,9 @@ void grpc_rb_channel_polling_thread_start() {
void grpc_rb_channel_polling_thread_stop() {
if (!RTEST(g_channel_polling_thread)) {
gpr_log(GPR_ERROR,
"GRPC_RUBY: channel polling thread stop: thread was not started");
grpc_absl_log(
GPR_ERROR,
"GRPC_RUBY: channel polling thread stop: thread was not started");
return;
}
rb_thread_call_without_gvl(run_poll_channels_loop_unblocking_func_wrapper,

@ -156,8 +156,9 @@ void grpc_rb_event_queue_thread_start() {
void grpc_rb_event_queue_thread_stop() {
GRPC_RUBY_ASSERT(g_one_time_init_done);
if (!RTEST(g_event_thread)) {
gpr_log(GPR_ERROR,
"GRPC_RUBY: call credentials thread stop: thread not running");
grpc_absl_log(
GPR_ERROR,
"GRPC_RUBY: call credentials thread stop: thread not running");
return;
}
rb_thread_call_without_gvl(grpc_rb_event_unblocking_func_wrapper, NULL, NULL,

@ -328,9 +328,9 @@ static void grpc_ruby_init_threads() {
// in gpr_once_init. In general, it appears to be unsafe to call
// into the ruby library while holding a non-ruby mutex, because a gil yield
// could end up trying to lock onto that same mutex and deadlocking.
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_ruby_init_threads g_bg_thread_init_done=%d",
g_bg_thread_init_done);
grpc_absl_log_int(GPR_DEBUG,
"GRPC_RUBY: grpc_ruby_init_threads g_bg_thread_init_done=",
g_bg_thread_init_done);
rb_mutex_lock(g_bg_thread_init_rb_mu);
if (!g_bg_thread_init_done) {
grpc_rb_event_queue_thread_start();
@ -347,11 +347,12 @@ void grpc_ruby_init() {
grpc_ruby_fork_guard();
grpc_init();
grpc_ruby_init_threads();
// (only gpr_log after logging has been initialized)
gpr_log(GPR_DEBUG,
"GRPC_RUBY: grpc_ruby_init - g_enable_fork_support=%d prev "
"g_grpc_ruby_init_count:%" PRId64,
g_enable_fork_support, g_grpc_ruby_init_count++);
// (only log after logging has been initialized)
grpc_absl_log_int(GPR_DEBUG,
"GRPC_RUBY: grpc_ruby_init - g_enable_fork_support=",
g_enable_fork_support);
grpc_absl_log_int(GPR_DEBUG,
"prev g_grpc_ruby_init_count:", g_grpc_ruby_init_count++);
}
// fork APIs, useable on linux with env var: GRPC_ENABLE_FORK_SUPPORT=1

@ -253,7 +253,9 @@ gpr_malloc_aligned_type gpr_malloc_aligned_import;
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;
grpc_absl_log_type grpc_absl_log_import;
grpc_absl_log_int_type grpc_absl_log_int_import;
grpc_absl_log_str_type grpc_absl_log_str_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;
@ -537,7 +539,9 @@ void grpc_rb_load_imports(HMODULE library) {
gpr_free_aligned_import = (gpr_free_aligned_type) GetProcAddress(library, "gpr_free_aligned");
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");
grpc_absl_log_import = (grpc_absl_log_type) GetProcAddress(library, "grpc_absl_log");
grpc_absl_log_int_import = (grpc_absl_log_int_type) GetProcAddress(library, "grpc_absl_log_int");
grpc_absl_log_str_import = (grpc_absl_log_str_type) GetProcAddress(library, "grpc_absl_log_str");
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");

@ -735,9 +735,15 @@ extern gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
typedef unsigned(*gpr_cpu_current_cpu_type)(void);
extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
#define gpr_cpu_current_cpu 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 void(*grpc_absl_log_type)(const char* file, int line, gpr_log_severity severity, const char* message_str);
extern grpc_absl_log_type grpc_absl_log_import;
#define grpc_absl_log grpc_absl_log_import
typedef void(*grpc_absl_log_int_type)(const char* file, int line, gpr_log_severity severity, const char* message_str, intptr_t num);
extern grpc_absl_log_int_type grpc_absl_log_int_import;
#define grpc_absl_log_int grpc_absl_log_int_import
typedef void(*grpc_absl_log_str_type)(const char* file, int line, gpr_log_severity severity, const char* message_str1, const char* message_str2);
extern grpc_absl_log_str_type grpc_absl_log_str_import;
#define grpc_absl_log_str grpc_absl_log_str_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

@ -68,9 +68,9 @@ static void grpc_rb_server_shutdown_and_notify_internal(grpc_rb_server* server,
server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL, NULL);
}
if (ev.type != GRPC_OP_COMPLETE) {
gpr_log(GPR_DEBUG,
"GRPC_RUBY: bad grpc_server_shutdown_and_notify result:%d",
ev.type);
grpc_absl_log_int(
GPR_DEBUG,
"GRPC_RUBY: bad grpc_server_shutdown_and_notify result:", ev.type);
}
}
}
@ -192,7 +192,7 @@ struct server_request_call_args {
static void shutdown_server_unblock_func(void* arg) {
grpc_rb_server* server = (grpc_rb_server*)arg;
gpr_log(GPR_DEBUG, "GRPC_RUBY: shutdown_server_unblock_func");
grpc_absl_log(GPR_DEBUG, "GRPC_RUBY: shutdown_server_unblock_func");
GRPC_RUBY_ASSERT(server->wrapped != NULL);
grpc_event event;
void* tag = &event;
@ -202,10 +202,12 @@ static void shutdown_server_unblock_func(void* arg) {
// cancelled all calls.
event = grpc_completion_queue_pluck(server->queue, tag,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
gpr_log(GPR_DEBUG,
"GRPC_RUBY: shutdown_server_unblock_func pluck event.type: %d "
"event.success: %d",
event.type, event.success);
grpc_absl_log_int(
GPR_DEBUG,
"GRPC_RUBY: shutdown_server_unblock_func pluck event.type: ", event.type);
grpc_absl_log_int(
GPR_DEBUG,
"GRPC_RUBY: shutdown_server_unblock_func event.success: ", event.success);
}
static VALUE grpc_rb_server_request_call_try(VALUE value_args) {

@ -2920,7 +2920,6 @@ src/core/tsi/transport_security_grpc.h \
src/core/tsi/transport_security_interface.h \
src/core/util/alloc.cc \
src/core/util/alloc.h \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/gcp_metadata_query.cc \
src/core/util/gcp_metadata_query.h \
@ -2947,11 +2946,9 @@ src/core/util/json/json_writer.h \
src/core/util/latent_see.cc \
src/core/util/latent_see.h \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
@ -2970,7 +2967,6 @@ src/core/util/unique_ptr_with_bitset.h \
src/core/util/upb_utils.h \
src/core/util/useful.h \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \

@ -2699,7 +2699,6 @@ src/core/tsi/transport_security_interface.h \
src/core/util/README.md \
src/core/util/alloc.cc \
src/core/util/alloc.h \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/gcp_metadata_query.cc \
src/core/util/gcp_metadata_query.h \
@ -2726,11 +2725,9 @@ src/core/util/json/json_writer.h \
src/core/util/latent_see.cc \
src/core/util/latent_see.h \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
@ -2749,7 +2746,6 @@ src/core/util/unique_ptr_with_bitset.h \
src/core/util/upb_utils.h \
src/core/util/useful.h \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \

@ -16,7 +16,6 @@
# Explicitly ban select functions from being used in gRPC.
#
# Any new instance of a deprecated function being used in the code will be
# flagged by the script. If there is a new instance of a deprecated function in
# a Pull Request, then the Sanity tests will fail for the Pull Request.
@ -28,54 +27,41 @@ import sys
os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "../../.."))
# More files may be added to the RUBY_PHP_ALLOW_LIST
# if they belong to the PHP or RUBY folder.
RUBY_PHP_ALLOW_LIST = [
"./include/grpc/support/log.h",
"./src/core/util/log.cc",
"./src/php/ext/grpc/call_credentials.c",
"./src/php/ext/grpc/channel.c",
"./src/ruby/ext/grpc/rb_call.c",
"./src/ruby/ext/grpc/rb_call_credentials.c",
"./src/ruby/ext/grpc/rb_channel.c",
"./src/ruby/ext/grpc/rb_event_thread.c",
"./src/ruby/ext/grpc/rb_grpc.c",
"./src/ruby/ext/grpc/rb_server.c",
]
# Map of deprecated functions to allowlist files
DEPRECATED_FUNCTION_TEMP_ALLOW_LIST = {
"gpr_log_severity": [
"./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_grpc_imports.generated.c",
"./src/ruby/ext/grpc/rb_grpc_imports.generated.h",
],
"gpr_log(": [
"./include/grpc/support/log.h",
"./src/core/util/android/log.cc",
"./src/core/util/linux/log.cc",
"./src/core/util/posix/log.cc",
"./src/core/util/windows/log.cc",
"./src/php/ext/grpc/call_credentials.c",
"./src/php/ext/grpc/channel.c",
"./src/ruby/ext/grpc/rb_call.c",
"./src/ruby/ext/grpc/rb_call_credentials.c",
"./src/ruby/ext/grpc/rb_channel.c",
"./src/ruby/ext/grpc/rb_event_thread.c",
"./src/ruby/ext/grpc/rb_grpc.c",
"./src/ruby/ext/grpc/rb_server.c",
],
"gpr_should_log(": [
"./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",
],
"gpr_log_message(": [
"./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",
],
# These experimental logging functions are only for php and ruby.
"grpc_absl_log(": RUBY_PHP_ALLOW_LIST,
"grpc_absl_log_int(": RUBY_PHP_ALLOW_LIST,
"grpc_absl_log_str(": RUBY_PHP_ALLOW_LIST,
# These have been deprecated.
# Most of these have been deleted.
# Putting this check here just to prevent people from
# submitting PRs with any of these commented out.
"gpr_assertion_failed": [], # Safe to delete this entry after Nov 2024.
"gpr_log(": [], # Safe to delete this entry after Nov 2024.
"gpr_log_func_args": [], # Safe to delete this entry after Nov 2024.
"gpr_set_log_function(": [], # Safe to delete this entry after Nov 2024.
"gpr_log_message": [], # Safe to delete this entry after Nov 2024.
"gpr_log_severity_string": [], # Safe to delete this entry after Nov 2024.
"gpr_set_log_function": [], # Safe to delete this entry after Nov 2024.
"gpr_set_log_verbosity": [], # Safe to delete this entry after Nov 2024.
"gpr_should_log": [], # Safe to delete this entry after Nov 2024.
"GPR_ASSERT": [], # Safe to delete this entry after Nov 2024.
"gpr_assertion_failed": [], # Safe to delete this entry after Nov 2024.
"GPR_DEBUG_ASSERT": [], # Safe to delete this entry after Nov 2024.
"gpr_log_severity_string": [], # Safe to delete this entry after Nov 2024.
"gpr_set_log_verbosity(": [], # Safe to delete this entry after Nov 2024.
}
errors = 0

Loading…
Cancel
Save