Skip to content

Commit 08421bd

Browse files
authored
Add documentation for enabling gRPC logging
Add documentation for enabling gRPC logging in READMEs and guides. Add Supported Ruby Versions section if missing. Move Supported Ruby Versions below Enabling Logging. [closes googleapis#1907]
1 parent 6b69a6f commit 08421bd

45 files changed

Lines changed: 1328 additions & 74 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google-cloud-bigquery-data_transfer/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,38 @@ end
5050
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
5151
to see the full list of Cloud APIs that we cover.
5252

53+
## Enabling Logging
54+
55+
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.
56+
57+
Configuring a Ruby stdlib logger:
58+
59+
```ruby
60+
require "logger"
61+
62+
module MyLogger
63+
LOGGER = Logger.new $stderr, level: Logger::WARN
64+
def logger
65+
LOGGER
66+
end
67+
end
68+
69+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
70+
module GRPC
71+
extend MyLogger
72+
end
73+
```
74+
75+
## Supported Ruby Versions
76+
77+
This library is supported on Ruby 2.0+.
78+
79+
However, Ruby 2.3 or later is strongly recommended, as earlier releases have
80+
reached or are nearing end-of-life. After June 1, 2018, Google will provide
81+
official support only for Ruby versions that are considered current and
82+
supported by Ruby Core (that is, Ruby versions that are either in normal
83+
maintenance or in security maintenance).
84+
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
85+
5386
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-bigquery-data_transfer/latest/google/cloud/bigquery/datatransfer/v1
5487
[Product Documentation]: https://cloud.google.com/bigquerydatatransfer

google-cloud-bigquery-data_transfer/lib/google/cloud/bigquery/data_transfer.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,39 @@ module Bigquery
6565
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
6666
# to see the full list of Cloud APIs that we cover.
6767
#
68+
# ## Enabling Logging
69+
#
70+
# To enable logging for this library, set the logger for the underlying
71+
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
72+
# logger that you set may be a Ruby stdlib
73+
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
74+
# as shown below, or a
75+
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
76+
# that will write logs to [Stackdriver
77+
# Logging](https://cloud.google.com/logging/). See
78+
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
79+
# and the gRPC
80+
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
81+
# for additional information.
82+
#
83+
# Configuring a Ruby stdlib logger:
84+
#
85+
# ```ruby
86+
# require "logger"
87+
#
88+
# module MyLogger
89+
# LOGGER = Logger.new $stderr, level: Logger::WARN
90+
# def logger
91+
# LOGGER
92+
# end
93+
# end
94+
#
95+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
96+
# module GRPC
97+
# extend MyLogger
98+
# end
99+
# ```
100+
#
68101
# [Product Documentation]: https://cloud.google.com/bigquerydatatransfer
69102
#
70103
#

google-cloud-bigtable/README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,37 @@ steps:
2020
$ gem install google-cloud-bigtable
2121
```
2222

23-
### Supported Ruby Versions
23+
### Next Steps
24+
- Read the [Client Library Documentation][] for Cloud Bigtable API
25+
to see other available methods on the client.
26+
- Read the [Cloud Bigtable API Product documentation][Product Documentation]
27+
to learn more about the product and see How-to Guides.
28+
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
29+
to see the full list of Cloud APIs that we cover.
30+
31+
## Enabling Logging
32+
33+
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.
34+
35+
Configuring a Ruby stdlib logger:
36+
37+
```ruby
38+
require "logger"
39+
40+
module MyLogger
41+
LOGGER = Logger.new $stderr, level: Logger::WARN
42+
def logger
43+
LOGGER
44+
end
45+
end
46+
47+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
48+
module GRPC
49+
extend MyLogger
50+
end
51+
```
52+
53+
## Supported Ruby Versions
2454

2555
This library is supported on Ruby 2.0+.
2656

@@ -31,13 +61,5 @@ supported by Ruby Core (that is, Ruby versions that are either in normal
3161
maintenance or in security maintenance).
3262
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
3363

34-
### Next Steps
35-
- Read the [Client Library Documentation][] for Cloud Bigtable API
36-
to see other available methods on the client.
37-
- Read the [Cloud Bigtable API Product documentation][Product Documentation]
38-
to learn more about the product and see How-to Guides.
39-
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
40-
to see the full list of Cloud APIs that we cover.
41-
4264
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-bigtable/latest/google/bigtable/v2
4365
[Product Documentation]: https://cloud.google.com/bigtable

google-cloud-bigtable/lib/google/cloud/bigtable.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,39 @@ module Cloud
4747
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
4848
# to see the full list of Cloud APIs that we cover.
4949
#
50+
# ## Enabling Logging
51+
#
52+
# To enable logging for this library, set the logger for the underlying
53+
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
54+
# logger that you set may be a Ruby stdlib
55+
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
56+
# as shown below, or a
57+
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
58+
# that will write logs to [Stackdriver
59+
# Logging](https://cloud.google.com/logging/). See
60+
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
61+
# and the gRPC
62+
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
63+
# for additional information.
64+
#
65+
# Configuring a Ruby stdlib logger:
66+
#
67+
# ```ruby
68+
# require "logger"
69+
#
70+
# module MyLogger
71+
# LOGGER = Logger.new $stderr, level: Logger::WARN
72+
# def logger
73+
# LOGGER
74+
# end
75+
# end
76+
#
77+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
78+
# module GRPC
79+
# extend MyLogger
80+
# end
81+
# ```
82+
#
5083
# [Product Documentation]: https://cloud.google.com/bigtable
5184
#
5285
#

google-cloud-container/README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,37 @@ zone = "us-central1-a"
3131
response = cluster_manager_client.list_clusters(project_id_2, zone)
3232
```
3333

34-
### Supported Ruby Versions
34+
### Next Steps
35+
- Read the [Client Library Documentation][] for Google Container Engine API
36+
to see other available methods on the client.
37+
- Read the [Google Container Engine API Product documentation][Product Documentation]
38+
to learn more about the product and see How-to Guides.
39+
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
40+
to see the full list of Cloud APIs that we cover.
41+
42+
## Enabling Logging
43+
44+
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.
45+
46+
Configuring a Ruby stdlib logger:
47+
48+
```ruby
49+
require "logger"
50+
51+
module MyLogger
52+
LOGGER = Logger.new $stderr, level: Logger::WARN
53+
def logger
54+
LOGGER
55+
end
56+
end
57+
58+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
59+
module GRPC
60+
extend MyLogger
61+
end
62+
```
63+
64+
## Supported Ruby Versions
3565

3666
This library is supported on Ruby 2.0+.
3767

@@ -42,13 +72,5 @@ supported by Ruby Core (that is, Ruby versions that are either in normal
4272
maintenance or in security maintenance).
4373
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
4474

45-
### Next Steps
46-
- Read the [Client Library Documentation][] for Google Container Engine API
47-
to see other available methods on the client.
48-
- Read the [Google Container Engine API Product documentation][Product Documentation]
49-
to learn more about the product and see How-to Guides.
50-
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
51-
to see the full list of Cloud APIs that we cover.
52-
5375
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-container/latest/google/container/v1
5476
[Product Documentation]: https://cloud.google.com/container-engine

google-cloud-container/lib/google/cloud/container.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@ module Cloud
5353
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
5454
# to see the full list of Cloud APIs that we cover.
5555
#
56+
# ## Enabling Logging
57+
#
58+
# To enable logging for this library, set the logger for the underlying
59+
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
60+
# logger that you set may be a Ruby stdlib
61+
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
62+
# as shown below, or a
63+
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
64+
# that will write logs to [Stackdriver
65+
# Logging](https://cloud.google.com/logging/). See
66+
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
67+
# and the gRPC
68+
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
69+
# for additional information.
70+
#
71+
# Configuring a Ruby stdlib logger:
72+
#
73+
# ```ruby
74+
# require "logger"
75+
#
76+
# module MyLogger
77+
# LOGGER = Logger.new $stderr, level: Logger::WARN
78+
# def logger
79+
# LOGGER
80+
# end
81+
# end
82+
#
83+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
84+
# module GRPC
85+
# extend MyLogger
86+
# end
87+
# ```
88+
#
5689
# [Product Documentation]: https://cloud.google.com/container
5790
#
5891
#

google-cloud-dataproc/README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,37 @@ cluster_controller_client.list_clusters(project_id_2, region).each_page do |page
4242
end
4343
```
4444

45-
### Supported Ruby Versions
45+
### Next Steps
46+
- Read the [Client Library Documentation][] for Google Cloud Dataproc API
47+
to see other available methods on the client.
48+
- Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
49+
to learn more about the product and see How-to Guides.
50+
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
51+
to see the full list of Cloud APIs that we cover.
52+
53+
## Enabling Logging
54+
55+
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.
56+
57+
Configuring a Ruby stdlib logger:
58+
59+
```ruby
60+
require "logger"
61+
62+
module MyLogger
63+
LOGGER = Logger.new $stderr, level: Logger::WARN
64+
def logger
65+
LOGGER
66+
end
67+
end
68+
69+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
70+
module GRPC
71+
extend MyLogger
72+
end
73+
```
74+
75+
## Supported Ruby Versions
4676

4777
This library is supported on Ruby 2.0+.
4878

@@ -53,13 +83,5 @@ supported by Ruby Core (that is, Ruby versions that are either in normal
5383
maintenance or in security maintenance).
5484
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
5585

56-
### Next Steps
57-
- Read the [Client Library Documentation][] for Google Cloud Dataproc API
58-
to see other available methods on the client.
59-
- Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
60-
to learn more about the product and see How-to Guides.
61-
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
62-
to see the full list of Cloud APIs that we cover.
63-
6486
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dataproc/latest/google/cloud/dataproc/v1
6587
[Product Documentation]: https://cloud.google.com/dataproc

google-cloud-dataproc/lib/google/cloud/dataproc.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,39 @@ module Cloud
6464
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
6565
# to see the full list of Cloud APIs that we cover.
6666
#
67+
# ## Enabling Logging
68+
#
69+
# To enable logging for this library, set the logger for the underlying
70+
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
71+
# logger that you set may be a Ruby stdlib
72+
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
73+
# as shown below, or a
74+
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
75+
# that will write logs to [Stackdriver
76+
# Logging](https://cloud.google.com/logging/). See
77+
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
78+
# and the gRPC
79+
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
80+
# for additional information.
81+
#
82+
# Configuring a Ruby stdlib logger:
83+
#
84+
# ```ruby
85+
# require "logger"
86+
#
87+
# module MyLogger
88+
# LOGGER = Logger.new $stderr, level: Logger::WARN
89+
# def logger
90+
# LOGGER
91+
# end
92+
# end
93+
#
94+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
95+
# module GRPC
96+
# extend MyLogger
97+
# end
98+
# ```
99+
#
67100
# [Product Documentation]: https://cloud.google.com/dataproc
68101
#
69102
#

google-cloud-datastore/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ query = datastore.query("Task").
4747
tasks = datastore.run query
4848
```
4949

50+
## Enabling Logging
51+
52+
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.
53+
54+
Configuring a Ruby stdlib logger:
55+
56+
```ruby
57+
require "logger"
58+
59+
module MyLogger
60+
LOGGER = Logger.new $stderr, level: Logger::WARN
61+
def logger
62+
LOGGER
63+
end
64+
end
65+
66+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67+
module GRPC
68+
extend MyLogger
69+
end
70+
```
71+
5072
## Supported Ruby Versions
5173

5274
This library is supported on Ruby 2.0+.

0 commit comments

Comments
 (0)