From 7a0222049defae8756a67aca90cdf693ac5153e0 Mon Sep 17 00:00:00 2001 From: tanvi-jagtap Date: Fri, 2 Aug 2024 05:12:46 +0000 Subject: [PATCH] [Gpr_To_Absl_Logging] --- grpc.def | 1 - include/grpc/support/log.h | 16 ---------------- src/core/util/latent_see.cc | 6 +++--- src/core/util/log.cc | 7 ------- src/core/util/ring_buffer.h | 2 +- src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 -- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 --- test/core/util/ring_buffer_test.cc | 7 ++++--- 8 files changed, 8 insertions(+), 36 deletions(-) diff --git a/grpc.def b/grpc.def index e220212fc67..ddc6440f34f 100644 --- a/grpc.def +++ b/grpc.def @@ -233,7 +233,6 @@ EXPORTS gpr_log gpr_should_log gpr_log_verbosity_init - gpr_set_log_function gpr_format_message gpr_strdup gpr_asprintf diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 263b69f5203..88e7628e0cc 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -55,22 +55,6 @@ GPRAPI int gpr_should_log(gpr_log_severity severity); GPRAPI void gpr_log_verbosity_init(void); -/** Log overrides: applications can use this API to intercept logging calls - and use their own implementations */ - -struct gpr_log_func_args { - const char* file; - int line; - gpr_log_severity severity; - const char* message; -}; - -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 deprecated_setting); - #ifdef __cplusplus } #endif diff --git a/src/core/util/latent_see.cc b/src/core/util/latent_see.cc index b40c93a8001..585a072c5b3 100644 --- a/src/core/util/latent_see.cc +++ b/src/core/util/latent_see.cc @@ -21,13 +21,13 @@ #include #include -#include "src/core/lib/gprpp/sync.h" -#include "src/core/util/ring_buffer.h" - #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include "src/core/lib/gprpp/sync.h" +#include "src/core/util/ring_buffer.h" + namespace grpc_core { namespace latent_see { diff --git a/src/core/util/log.cc b/src/core/util/log.cc index 6726cde67d1..411f76a14cd 100644 --- a/src/core/util/log.cc +++ b/src/core/util/log.cc @@ -119,10 +119,3 @@ void gpr_log_verbosity_init(void) { } #endif // GRPC_VERBOSITY_MACRO } - -void gpr_set_log_function([[maybe_unused]] gpr_log_func deprecated_setting) { - LOG(ERROR) - << "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 "; -} diff --git a/src/core/util/ring_buffer.h b/src/core/util/ring_buffer.h index 2789e7d4d32..4e1039c8aee 100644 --- a/src/core/util/ring_buffer.h +++ b/src/core/util/ring_buffer.h @@ -50,7 +50,7 @@ class RingBuffer { T operator*() { return buffer_->data_[head_]; } - RingBufferIterator() : buffer_(nullptr), head_(0), size_(0) {}; + RingBufferIterator() : buffer_(nullptr), head_(0), size_(0){}; RingBufferIterator(const RingBufferIterator& other) = default; RingBufferIterator(const RingBuffer* buffer) : buffer_(buffer), head_(buffer->head_), size_(buffer->size_) { diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 01f66dbdc43..b0cfa9ce6b0 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -256,7 +256,6 @@ gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import; gpr_log_type gpr_log_import; gpr_should_log_type gpr_should_log_import; gpr_log_verbosity_init_type gpr_log_verbosity_init_import; -gpr_set_log_function_type gpr_set_log_function_import; gpr_format_message_type gpr_format_message_import; gpr_strdup_type gpr_strdup_import; gpr_asprintf_type gpr_asprintf_import; @@ -542,7 +541,6 @@ void grpc_rb_load_imports(HMODULE library) { gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log"); gpr_should_log_import = (gpr_should_log_type) GetProcAddress(library, "gpr_should_log"); gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init"); - gpr_set_log_function_import = (gpr_set_log_function_type) GetProcAddress(library, "gpr_set_log_function"); gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message"); gpr_strdup_import = (gpr_strdup_type) GetProcAddress(library, "gpr_strdup"); gpr_asprintf_import = (gpr_asprintf_type) GetProcAddress(library, "gpr_asprintf"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 48fe5f38e05..1b325a1a024 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -744,9 +744,6 @@ extern gpr_should_log_type gpr_should_log_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 -typedef void(*gpr_set_log_function_type)(gpr_log_func deprecated_setting); -extern gpr_set_log_function_type gpr_set_log_function_import; -#define gpr_set_log_function gpr_set_log_function_import typedef char*(*gpr_format_message_type)(int messageid); extern gpr_format_message_type gpr_format_message_import; #define gpr_format_message gpr_format_message_import diff --git a/test/core/util/ring_buffer_test.cc b/test/core/util/ring_buffer_test.cc index 8531c4b9878..808018d0538 100644 --- a/test/core/util/ring_buffer_test.cc +++ b/test/core/util/ring_buffer_test.cc @@ -16,10 +16,11 @@ // // -#include +#include "src/core/util/ring_buffer.h" #include "gtest/gtest.h" -#include "src/core/util/ring_buffer.h" + +#include namespace grpc_core { @@ -29,7 +30,7 @@ TEST(RingBufferTest, BufferAppendPopTest) { RingBuffer buffer; EXPECT_FALSE(buffer.PopIfNotEmpty().has_value()); - for (int i = 0; i < (3 * kBufferCapacity)/2; ++i) { + for (int i = 0; i < (3 * kBufferCapacity) / 2; ++i) { buffer.Append(i); } // Pop half of the elements. Elements in [kBufferCapacity / 2,