| Index: third_party/grpc/src/ruby/lib/grpc/logconfig.rb
|
| diff --git a/third_party/protobuf/ruby/lib/google/protobuf/message_exts.rb b/third_party/grpc/src/ruby/lib/grpc/logconfig.rb
|
| similarity index 66%
|
| copy from third_party/protobuf/ruby/lib/google/protobuf/message_exts.rb
|
| copy to third_party/grpc/src/ruby/lib/grpc/logconfig.rb
|
| index e10266ba2f3637d655c2de89c285558c987c613b..6b442febcb77a97284c3595ba925242caa275953 100644
|
| --- a/third_party/protobuf/ruby/lib/google/protobuf/message_exts.rb
|
| +++ b/third_party/grpc/src/ruby/lib/grpc/logconfig.rb
|
| @@ -1,6 +1,5 @@
|
| -# Protocol Buffers - Google's data interchange format
|
| -# Copyright 2008 Google Inc. All rights reserved.
|
| -# https://developers.google.com/protocol-buffers/
|
| +# Copyright 2015, Google Inc.
|
| +# All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| # modification, are permitted provided that the following conditions are
|
| @@ -28,26 +27,33 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -module Google
|
| - module Protobuf
|
| - module MessageExts
|
| +# GRPC contains the General RPC module.
|
| +module GRPC
|
| + # DefaultLogger is a module included in GRPC if no other logging is set up for
|
| + # it. See ../spec/spec_helpers an example of where other logging is added.
|
| + module DefaultLogger
|
| + def logger
|
| + LOGGER
|
| + end
|
|
|
| - #this is only called in jruby; mri loades the ClassMethods differently
|
| - def self.included(klass)
|
| - klass.extend(ClassMethods)
|
| - end
|
| + private
|
|
|
| - module ClassMethods
|
| + # NoopLogger implements the methods of Ruby's conventional logging interface
|
| + # that are actually used internally within gRPC with a noop implementation.
|
| + class NoopLogger
|
| + def info(_ignored)
|
| end
|
|
|
| - def to_json
|
| - self.class.encode_json(self)
|
| + def debug(_ignored)
|
| end
|
|
|
| - def to_proto
|
| - self.class.encode(self)
|
| + def warn(_ignored)
|
| end
|
| -
|
| end
|
| +
|
| + LOGGER = NoopLogger.new
|
| end
|
| +
|
| + # Inject the noop #logger if no module-level logger method has been injected.
|
| + extend DefaultLogger unless methods.include?(:logger)
|
| end
|
|
|