diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index e02d48971..6e33842cc 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - version = '1.65.0-pre1' + version = '1.65.0-pre2' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 1af308a43..2260c4413 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.65.0-pre1' + version = '1.65.0-pre2' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 2610c0141..a0fd7d00e 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.65.0-pre1' + version = '1.65.0-pre2' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 48cf179ff..a28ed10f2 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.65.0-pre1' + version = '1.65.0-pre2' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index f053f78d1..0ea492a8a 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.65.0-pre1' + version = '1.65.0-pre2' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 575600296..30117dd53 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -28,15 +28,10 @@ extern "C" { #endif -/** GPR log API. - - Usage (within grpc): - - int argument1 = 3; - char* argument2 = "hello"; - gpr_log(GPR_DEBUG, "format string %d", argument1); - gpr_log(GPR_INFO, "hello world"); - gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */ +/** + * 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 */ @@ -65,7 +60,7 @@ GPRAPI void gpr_log_message(const char* file, int line, gpr_log_severity severity, const char* message); /** Set global log verbosity */ -GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print); +GPRAPI void gpr_set_log_verbosity(gpr_log_severity deprecated_setting); GPRAPI void gpr_log_verbosity_init(void); @@ -83,7 +78,7 @@ typedef struct gpr_log_func_args gpr_log_func_args; typedef void (*gpr_log_func)(gpr_log_func_args* args); -GPRAPI void gpr_set_log_function(gpr_log_func func); +GPRAPI void gpr_set_log_function(gpr_log_func deprecated_setting); GPRAPI void gpr_assertion_failed(const char* filename, int line, const char* message) GPR_ATTRIBUTE_NORETURN; diff --git a/include/grpcpp/version_info.h b/include/grpcpp/version_info.h index 96baedcc2..cef55c1a7 100644 --- a/include/grpcpp/version_info.h +++ b/include/grpcpp/version_info.h @@ -21,7 +21,7 @@ #define GRPC_CPP_VERSION_MAJOR 1 #define GRPC_CPP_VERSION_MINOR 65 #define GRPC_CPP_VERSION_PATCH 0 -#define GRPC_CPP_VERSION_TAG "pre1" -#define GRPC_CPP_VERSION_STRING "1.65.0-pre1" +#define GRPC_CPP_VERSION_TAG "pre2" +#define GRPC_CPP_VERSION_STRING "1.65.0-pre2" #endif // GRPCPP_VERSION_INFO_H diff --git a/src/core/lib/config/config_vars.cc b/src/core/lib/config/config_vars.cc index b3a919b11..c67f4463f 100644 --- a/src/core/lib/config/config_vars.cc +++ b/src/core/lib/config/config_vars.cc @@ -26,7 +26,7 @@ #include "src/core/lib/config/load_config.h" #ifndef GPR_DEFAULT_LOG_VERBOSITY_STRING -#define GPR_DEFAULT_LOG_VERBOSITY_STRING "ERROR" +#define GPR_DEFAULT_LOG_VERBOSITY_STRING "" #endif // !GPR_DEFAULT_LOG_VERBOSITY_STRING #ifdef GRPC_ENABLE_FORK_SUPPORT diff --git a/src/core/util/log.cc b/src/core/util/log.cc index 77326f716..a57f67580 100644 --- a/src/core/util/log.cc +++ b/src/core/util/log.cc @@ -35,18 +35,9 @@ #include "src/core/lib/gprpp/crash.h" #include "src/core/util/string.h" -#ifndef GPR_DEFAULT_LOG_VERBOSITY_STRING -#define GPR_DEFAULT_LOG_VERBOSITY_STRING "ERROR" -#endif // !GPR_DEFAULT_LOG_VERBOSITY_STRING - -static constexpr gpr_atm GPR_LOG_SEVERITY_UNSET = GPR_LOG_SEVERITY_ERROR + 10; -static constexpr gpr_atm GPR_LOG_SEVERITY_NONE = GPR_LOG_SEVERITY_ERROR + 11; - void gpr_default_log(gpr_log_func_args* args); void gpr_platform_log(gpr_log_func_args* args); static gpr_atm g_log_func = reinterpret_cast(gpr_default_log); -static gpr_atm g_min_severity_to_print = GPR_LOG_SEVERITY_UNSET; -static gpr_atm g_min_severity_to_print_stacktrace = GPR_LOG_SEVERITY_UNSET; void gpr_unreachable_code(const char* reason, const char* file, int line) { grpc_core::Crash(absl::StrCat("UNREACHABLE CODE: ", reason), @@ -71,10 +62,22 @@ const char* gpr_log_severity_string(gpr_log_severity severity) { } int gpr_should_log(gpr_log_severity severity) { - return static_cast(severity) >= - gpr_atm_no_barrier_load(&g_min_severity_to_print) - ? 1 - : 0; + 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 VLOG_IS_ON(2). + return absl::MinLogLevel() <= absl::LogSeverityAtLeast::kInfo; + case GPR_LOG_SEVERITY_DEBUG: + return VLOG_IS_ON(2); + default: + DLOG(ERROR) << "Invalid gpr_log_severity."; + return true; + } } void gpr_default_log(gpr_log_func_args* args) { @@ -111,25 +114,21 @@ void gpr_log_message(const char* file, int line, gpr_log_severity severity, reinterpret_cast(gpr_atm_no_barrier_load(&g_log_func))(&lfargs); } -void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print) { - gpr_atm_no_barrier_store(&g_min_severity_to_print, - (gpr_atm)min_severity_to_print); -} - -static gpr_atm parse_log_severity(absl::string_view str, gpr_atm error_value) { - if (absl::EqualsIgnoreCase(str, "DEBUG")) return GPR_LOG_SEVERITY_DEBUG; - if (absl::EqualsIgnoreCase(str, "INFO")) return GPR_LOG_SEVERITY_INFO; - if (absl::EqualsIgnoreCase(str, "ERROR")) return GPR_LOG_SEVERITY_ERROR; - if (absl::EqualsIgnoreCase(str, "NONE")) return GPR_LOG_SEVERITY_NONE; - return error_value; +void gpr_set_log_verbosity( + [[maybe_unused]] gpr_log_severity deprecated_setting) { + LOG(ERROR) + << "This will not be set. Please set this via absl log level settings."; } -void gpr_to_absl_verbosity_setting_init(void) { +void gpr_log_verbosity_init(void) { // This is enabled in Github only. // This ifndef is converted to ifdef internally by copybara. // Internally grpc verbosity is managed using absl settings. // So internally we avoid setting it like this. #ifndef GRPC_VERBOSITY_MACRO + // SetMinLogLevel sets the value for the entire binary, not just gRPC. + // This setting will change things for other libraries/code that is unrelated + // to grpc. absl::string_view verbosity = grpc_core::ConfigVars::Get().Verbosity(); DVLOG(2) << "Log verbosity: " << verbosity; if (absl::EqualsIgnoreCase(verbosity, "INFO")) { @@ -150,50 +149,17 @@ void gpr_to_absl_verbosity_setting_init(void) { } else if (absl::EqualsIgnoreCase(verbosity, "NONE")) { absl::SetVLogLevel("*grpc*/*", -1); absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); + } else if (verbosity.empty()) { + // Do not alter absl settings if GRPC_VERBOSITY flag is not set. } else { LOG(ERROR) << "Unknown log verbosity: " << verbosity; } #endif // GRPC_VERBOSITY_MACRO } -void gpr_log_verbosity_init() { - // init verbosity when it hasn't been set - if ((gpr_atm_no_barrier_load(&g_min_severity_to_print)) == - GPR_LOG_SEVERITY_UNSET) { - auto verbosity = grpc_core::ConfigVars::Get().Verbosity(); - gpr_atm min_severity_to_print = GPR_LOG_SEVERITY_ERROR; - if (!verbosity.empty()) { - min_severity_to_print = - parse_log_severity(verbosity, min_severity_to_print); - } - gpr_atm_no_barrier_store(&g_min_severity_to_print, min_severity_to_print); - } - // init stacktrace_minloglevel when it hasn't been set - if ((gpr_atm_no_barrier_load(&g_min_severity_to_print_stacktrace)) == - GPR_LOG_SEVERITY_UNSET) { - auto stacktrace_minloglevel = - grpc_core::ConfigVars::Get().StacktraceMinloglevel(); - gpr_atm min_severity_to_print_stacktrace = GPR_LOG_SEVERITY_NONE; - if (!stacktrace_minloglevel.empty()) { - min_severity_to_print_stacktrace = parse_log_severity( - stacktrace_minloglevel, min_severity_to_print_stacktrace); - } - gpr_atm_no_barrier_store(&g_min_severity_to_print_stacktrace, - min_severity_to_print_stacktrace); - } - gpr_to_absl_verbosity_setting_init(); -} - -void gpr_set_log_function(gpr_log_func f) { +void gpr_set_log_function([[maybe_unused]] gpr_log_func deprecated_setting) { LOG(ERROR) - << "This function is in the process of being deprecated. Your " - "gpr_log_func will not work as expected. This is because only few " - "instances of gpr_log remain in our code base. All instances of " - "gpr_log will log via this custom function. Many of the gpr_log " - "statements have been converted to ABSL_LOG statements. These will " - "log to the default absl log sink. The gpr_set_log_function function " - "will be deleted in the next gRPC release. We strongly advice against " - "using this function. You may create a new absl LogSink with similar " + << "This function is deprecated. This function will be deleted in the " + "next gRPC release. You may create a new absl LogSink with similar " "functionality. gRFC: https://github.com/grpc/proposal/pull/425 "; - gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)(f ? f : gpr_default_log)); } diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 3a8acb482..281af1c94 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.65.0-pre1' + v = '1.65.0-pre2' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 0d88ff988..8efcc3ff4 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.65.0-pre1' + v = '1.65.0-pre2' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/version.h b/src/objective-c/GRPCClient/version.h index 6a735382c..aa088439e 100644 --- a/src/objective-c/GRPCClient/version.h +++ b/src/objective-c/GRPCClient/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.65.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.65.0-pre2"