diff --git a/BUILD b/BUILD index cffec640d92..8600d1f7e86 100644 --- a/BUILD +++ b/BUILD @@ -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", diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e9f6efd927..1393b57a180 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Makefile b/Makefile index aff525ee1de..87fecd8ba58 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/Package.swift b/Package.swift index 6b6efd5b851..719b25c4a81 100644 --- a/Package.swift +++ b/Package.swift @@ -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", diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index cfbb244d513..67457572413 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -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 diff --git a/config.m4 b/config.m4 index d788623260b..17886c07dd5 100644 --- a/config.m4 +++ b/config.m4 @@ -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) diff --git a/config.w32 b/config.w32 index 44f4cda251d..2f087a6943b 100644 --- a/config.w32 +++ b/config.w32 @@ -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"); diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 308b9a5a2b7..a4751ea0e1b 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -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', diff --git a/grpc.def b/grpc.def index 59bc8f2aa78..26030cd9faf 100644 --- a/grpc.def +++ b/grpc.def @@ -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 diff --git a/grpc.gemspec b/grpc.gemspec index d4f2c1aeca7..f8c9988b45a 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -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 ) diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index d536bc85922..aa7f133177d 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -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); diff --git a/package.xml b/package.xml index 83c86c5693d..de24f221508 100644 --- a/package.xml +++ b/package.xml @@ -1897,7 +1897,6 @@ - @@ -1924,11 +1923,9 @@ - - @@ -1947,7 +1944,6 @@ - diff --git a/src/core/util/android/log.cc b/src/core/util/android/log.cc deleted file mode 100644 index 967000490da..00000000000 --- a/src/core/util/android/log.cc +++ /dev/null @@ -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 - -#ifdef GPR_ANDROID - -#include -#include -#include -#include - -#include -#include - -#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 diff --git a/src/core/util/linux/log.cc b/src/core/util/linux/log.cc deleted file mode 100644 index 108ff3cb4e7..00000000000 --- a/src/core/util/linux/log.cc +++ /dev/null @@ -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 - -#ifdef GPR_LINUX_LOG - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "absl/strings/str_format.h" - -#include -#include -#include - -#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 diff --git a/src/core/util/log.cc b/src/core/util/log.cc index d32c8373787..0a1ef08f75c 100644 --- a/src/core/util/log.cc +++ b/src/core/util/log.cc @@ -23,6 +23,7 @@ #include #include +#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"; } } diff --git a/src/core/util/posix/log.cc b/src/core/util/posix/log.cc deleted file mode 100644 index abd7dfe6043..00000000000 --- a/src/core/util/posix/log.cc +++ /dev/null @@ -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 - -#ifdef GPR_POSIX_LOG - -#include -#include -#include -#include -#include -#include - -#include - -#include "absl/strings/str_format.h" - -#include -#include -#include - -#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) diff --git a/src/core/util/windows/log.cc b/src/core/util/windows/log.cc deleted file mode 100644 index c5b764032a3..00000000000 --- a/src/core/util/windows/log.cc +++ /dev/null @@ -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 - -#ifdef GPR_WINDOWS_LOG - -#include -#include - -#include -#include -#include -#include -#include - -#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 diff --git a/src/php/ext/grpc/call_credentials.c b/src/php/ext/grpc/call_credentials.c index 7082b41e61c..2536cf2ccce 100644 --- a/src/php/ext/grpc/call_credentials.c +++ b/src/php/ext/grpc/call_credentials.c @@ -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; diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 0dca12debfa..661c0bcc4f7 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -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; } } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 1bd00485826..c27a3690636 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -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', diff --git a/src/python/grpcio_observability/observability_lib_deps.py b/src/python/grpcio_observability/observability_lib_deps.py index 662a1f04865..290c367b440 100644 --- a/src/python/grpcio_observability/observability_lib_deps.py +++ b/src/python/grpcio_observability/observability_lib_deps.py @@ -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', diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 50467e5429c..2ef9b6a54f7 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -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); } diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c index 14bce49d37f..8c69c82b1e3 100644 --- a/src/ruby/ext/grpc/rb_call_credentials.c +++ b/src/ruby/ext/grpc/rb_call_credentials.c @@ -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)); diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 580ef9ebd25..2c800d8b9ec 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -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, diff --git a/src/ruby/ext/grpc/rb_event_thread.c b/src/ruby/ext/grpc/rb_event_thread.c index eaa77965de4..0d7ec2ea2f4 100644 --- a/src/ruby/ext/grpc/rb_event_thread.c +++ b/src/ruby/ext/grpc/rb_event_thread.c @@ -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, diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 67e80a5bf30..b26ddf357c0 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -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 diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 31cb6523097..b8346703664 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -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"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 02aee5008a7..b99ff7c2b0a 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -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 diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 70561f103e0..09e8788b9ed 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -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) { diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 688e4b2b5e6..e000762b1bc 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -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 \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index da4ee1e889d..1d1d04c9bd0 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -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 \ diff --git a/tools/run_tests/sanity/banned_functions.py b/tools/run_tests/sanity/banned_functions.py index cd00ec58c57..a71b8a62b87 100755 --- a/tools/run_tests/sanity/banned_functions.py +++ b/tools/run_tests/sanity/banned_functions.py @@ -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