lib/google/cloud/translate.rb in google-cloud-translate-1.2.0 vs lib/google/cloud/translate.rb in google-cloud-translate-1.2.1
- old
+ new
@@ -43,9 +43,42 @@
# it supports authentication using a public API access key. (If both the API
# key and the project and OAuth 2.0 credentials are provided, the API key
# will be used.) Instructions and configuration options are covered in the
# [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-translate/guides/authentication).
#
+ # ## Enabling Logging
+ #
+ # To enable logging for this library, set the logger for the underlying
+ # [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
+ # logger that you set may be a Ruby stdlib
+ # [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
+ # as shown below, or a
+ # [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
+ # that will write logs to [Stackdriver
+ # Logging](https://cloud.google.com/logging/). See
+ # [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
+ # and the gRPC
+ # [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
+ # for additional information.
+ #
+ # Configuring a Ruby stdlib logger:
+ #
+ # ```ruby
+ # require "logger"
+ #
+ # module MyLogger
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
+ # def logger
+ # LOGGER
+ # end
+ # end
+ #
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
+ # module GRPC
+ # extend MyLogger
+ # end
+ # ```
+ #
# ## Translating texts
#
# Translating text from one language to another is easy (and extremely
# fast.) The only required arguments to
# {Google::Cloud::Translate::Api#translate} are a string and the [ISO