google-cloud-logging-v2 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1de3582a8bd85aec173e931ee3aed5f7a6634ab07b6f7a63f202455691587679
4
- data.tar.gz: 4957efcc7cc799f645d254f7ea34e66bb0521baca763c081177a4d9105370dc7
3
+ metadata.gz: 4a27eec40dfcefc80fbbac99944c6589e0983016399cede5be084124084e836e
4
+ data.tar.gz: 5fe279ae0020ae1523365f4b09cd81cd08debad15f6d6338d0705e0a9cae31b9
5
5
  SHA512:
6
- metadata.gz: 3cf5741ef24c1959e9a2baf38fb23ce1f3d78d3a6fe5f327c843ca6f7b8a924bd429bfc047afefbdeecd4ef69c60889c0857d8950bd02c905dd3a82cc1038ba6
7
- data.tar.gz: c3c5c08fa262e781aa8ce4691289909bb0ab2d02e15e342cfedc56af213535fbb1296d14146c7c322f40235f7f1daac5423e95411f8f05fae9c5e08360e93fd8
6
+ metadata.gz: 2f35a362ab779bb1e558654f654012315dc52e57385d4826c7c6ac712358264979d1666da41f02dc6c0323432c8ae75a05123f438e76056ac4cc185cb8e01e7b
7
+ data.tar.gz: 9a552c21e683ba2b0ff86d15661adcdc07eeb22e2849ac59bfb32d080e791b4bc37f4c1e75c1adfe30d11aa2934c908129fd55dafd04782bf865fd539899fb45
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/logging)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- 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:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/logging/v2"
57
76
  require "logger"
58
77
 
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
78
+ client = ::Google::Cloud::Logging::V2::LoggingService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -205,8 +205,19 @@ module Google
205
205
  universe_domain: @config.universe_domain,
206
206
  channel_args: @config.channel_args,
207
207
  interceptors: @config.interceptors,
208
- channel_pool_config: @config.channel_pool
208
+ channel_pool_config: @config.channel_pool,
209
+ logger: @config.logger
209
210
  )
211
+
212
+ @config_service_stub.stub_logger&.info do |entry|
213
+ entry.set_system_name
214
+ entry.set_service
215
+ entry.message = "Created client for #{entry.service}"
216
+ entry.set_credentials_fields credentials
217
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
218
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
219
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
220
+ end
210
221
  end
211
222
 
212
223
  ##
@@ -216,6 +227,15 @@ module Google
216
227
  #
217
228
  attr_reader :operations_client
218
229
 
230
+ ##
231
+ # The logger used for request/response debug logging.
232
+ #
233
+ # @return [Logger]
234
+ #
235
+ def logger
236
+ @config_service_stub.logger
237
+ end
238
+
219
239
  # Service calls
220
240
 
221
241
  ##
@@ -321,7 +341,7 @@ module Google
321
341
  @config_service_stub.call_rpc :list_buckets, request, options: options do |response, operation|
322
342
  response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_buckets, request, response, operation, options
323
343
  yield response, operation if block_given?
324
- return response
344
+ throw :response, response
325
345
  end
326
346
  rescue ::GRPC::BadStatus => e
327
347
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,7 +436,6 @@ module Google
416
436
 
417
437
  @config_service_stub.call_rpc :get_bucket, request, options: options do |response, operation|
418
438
  yield response, operation if block_given?
419
- return response
420
439
  end
421
440
  rescue ::GRPC::BadStatus => e
422
441
  raise ::Google::Cloud::Error.from_error(e)
@@ -526,7 +545,7 @@ module Google
526
545
  @config_service_stub.call_rpc :create_bucket_async, request, options: options do |response, operation|
527
546
  response = ::Gapic::Operation.new response, @operations_client, options: options
528
547
  yield response, operation if block_given?
529
- return response
548
+ throw :response, response
530
549
  end
531
550
  rescue ::GRPC::BadStatus => e
532
551
  raise ::Google::Cloud::Error.from_error(e)
@@ -645,7 +664,7 @@ module Google
645
664
  @config_service_stub.call_rpc :update_bucket_async, request, options: options do |response, operation|
646
665
  response = ::Gapic::Operation.new response, @operations_client, options: options
647
666
  yield response, operation if block_given?
648
- return response
667
+ throw :response, response
649
668
  end
650
669
  rescue ::GRPC::BadStatus => e
651
670
  raise ::Google::Cloud::Error.from_error(e)
@@ -746,7 +765,6 @@ module Google
746
765
 
747
766
  @config_service_stub.call_rpc :create_bucket, request, options: options do |response, operation|
748
767
  yield response, operation if block_given?
749
- return response
750
768
  end
751
769
  rescue ::GRPC::BadStatus => e
752
770
  raise ::Google::Cloud::Error.from_error(e)
@@ -857,7 +875,6 @@ module Google
857
875
 
858
876
  @config_service_stub.call_rpc :update_bucket, request, options: options do |response, operation|
859
877
  yield response, operation if block_given?
860
- return response
861
878
  end
862
879
  rescue ::GRPC::BadStatus => e
863
880
  raise ::Google::Cloud::Error.from_error(e)
@@ -956,7 +973,6 @@ module Google
956
973
 
957
974
  @config_service_stub.call_rpc :delete_bucket, request, options: options do |response, operation|
958
975
  yield response, operation if block_given?
959
- return response
960
976
  end
961
977
  rescue ::GRPC::BadStatus => e
962
978
  raise ::Google::Cloud::Error.from_error(e)
@@ -1052,7 +1068,6 @@ module Google
1052
1068
 
1053
1069
  @config_service_stub.call_rpc :undelete_bucket, request, options: options do |response, operation|
1054
1070
  yield response, operation if block_given?
1055
- return response
1056
1071
  end
1057
1072
  rescue ::GRPC::BadStatus => e
1058
1073
  raise ::Google::Cloud::Error.from_error(e)
@@ -1155,7 +1170,7 @@ module Google
1155
1170
  @config_service_stub.call_rpc :list_views, request, options: options do |response, operation|
1156
1171
  response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_views, request, response, operation, options
1157
1172
  yield response, operation if block_given?
1158
- return response
1173
+ throw :response, response
1159
1174
  end
1160
1175
  rescue ::GRPC::BadStatus => e
1161
1176
  raise ::Google::Cloud::Error.from_error(e)
@@ -1247,7 +1262,6 @@ module Google
1247
1262
 
1248
1263
  @config_service_stub.call_rpc :get_view, request, options: options do |response, operation|
1249
1264
  yield response, operation if block_given?
1250
- return response
1251
1265
  end
1252
1266
  rescue ::GRPC::BadStatus => e
1253
1267
  raise ::Google::Cloud::Error.from_error(e)
@@ -1346,7 +1360,6 @@ module Google
1346
1360
 
1347
1361
  @config_service_stub.call_rpc :create_view, request, options: options do |response, operation|
1348
1362
  yield response, operation if block_given?
1349
- return response
1350
1363
  end
1351
1364
  rescue ::GRPC::BadStatus => e
1352
1365
  raise ::Google::Cloud::Error.from_error(e)
@@ -1453,7 +1466,6 @@ module Google
1453
1466
 
1454
1467
  @config_service_stub.call_rpc :update_view, request, options: options do |response, operation|
1455
1468
  yield response, operation if block_given?
1456
- return response
1457
1469
  end
1458
1470
  rescue ::GRPC::BadStatus => e
1459
1471
  raise ::Google::Cloud::Error.from_error(e)
@@ -1548,7 +1560,6 @@ module Google
1548
1560
 
1549
1561
  @config_service_stub.call_rpc :delete_view, request, options: options do |response, operation|
1550
1562
  yield response, operation if block_given?
1551
- return response
1552
1563
  end
1553
1564
  rescue ::GRPC::BadStatus => e
1554
1565
  raise ::Google::Cloud::Error.from_error(e)
@@ -1653,7 +1664,7 @@ module Google
1653
1664
  @config_service_stub.call_rpc :list_sinks, request, options: options do |response, operation|
1654
1665
  response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_sinks, request, response, operation, options
1655
1666
  yield response, operation if block_given?
1656
- return response
1667
+ throw :response, response
1657
1668
  end
1658
1669
  rescue ::GRPC::BadStatus => e
1659
1670
  raise ::Google::Cloud::Error.from_error(e)
@@ -1748,7 +1759,6 @@ module Google
1748
1759
 
1749
1760
  @config_service_stub.call_rpc :get_sink, request, options: options do |response, operation|
1750
1761
  yield response, operation if block_given?
1751
- return response
1752
1762
  end
1753
1763
  rescue ::GRPC::BadStatus => e
1754
1764
  raise ::Google::Cloud::Error.from_error(e)
@@ -1863,7 +1873,6 @@ module Google
1863
1873
 
1864
1874
  @config_service_stub.call_rpc :create_sink, request, options: options do |response, operation|
1865
1875
  yield response, operation if block_given?
1866
- return response
1867
1876
  end
1868
1877
  rescue ::GRPC::BadStatus => e
1869
1878
  raise ::Google::Cloud::Error.from_error(e)
@@ -1995,7 +2004,6 @@ module Google
1995
2004
 
1996
2005
  @config_service_stub.call_rpc :update_sink, request, options: options do |response, operation|
1997
2006
  yield response, operation if block_given?
1998
- return response
1999
2007
  end
2000
2008
  rescue ::GRPC::BadStatus => e
2001
2009
  raise ::Google::Cloud::Error.from_error(e)
@@ -2092,7 +2100,6 @@ module Google
2092
2100
 
2093
2101
  @config_service_stub.call_rpc :delete_sink, request, options: options do |response, operation|
2094
2102
  yield response, operation if block_given?
2095
- return response
2096
2103
  end
2097
2104
  rescue ::GRPC::BadStatus => e
2098
2105
  raise ::Google::Cloud::Error.from_error(e)
@@ -2199,7 +2206,7 @@ module Google
2199
2206
  @config_service_stub.call_rpc :create_link, request, options: options do |response, operation|
2200
2207
  response = ::Gapic::Operation.new response, @operations_client, options: options
2201
2208
  yield response, operation if block_given?
2202
- return response
2209
+ throw :response, response
2203
2210
  end
2204
2211
  rescue ::GRPC::BadStatus => e
2205
2212
  raise ::Google::Cloud::Error.from_error(e)
@@ -2299,7 +2306,7 @@ module Google
2299
2306
  @config_service_stub.call_rpc :delete_link, request, options: options do |response, operation|
2300
2307
  response = ::Gapic::Operation.new response, @operations_client, options: options
2301
2308
  yield response, operation if block_given?
2302
- return response
2309
+ throw :response, response
2303
2310
  end
2304
2311
  rescue ::GRPC::BadStatus => e
2305
2312
  raise ::Google::Cloud::Error.from_error(e)
@@ -2401,7 +2408,7 @@ module Google
2401
2408
  @config_service_stub.call_rpc :list_links, request, options: options do |response, operation|
2402
2409
  response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_links, request, response, operation, options
2403
2410
  yield response, operation if block_given?
2404
- return response
2411
+ throw :response, response
2405
2412
  end
2406
2413
  rescue ::GRPC::BadStatus => e
2407
2414
  raise ::Google::Cloud::Error.from_error(e)
@@ -2492,7 +2499,6 @@ module Google
2492
2499
 
2493
2500
  @config_service_stub.call_rpc :get_link, request, options: options do |response, operation|
2494
2501
  yield response, operation if block_given?
2495
- return response
2496
2502
  end
2497
2503
  rescue ::GRPC::BadStatus => e
2498
2504
  raise ::Google::Cloud::Error.from_error(e)
@@ -2597,7 +2603,7 @@ module Google
2597
2603
  @config_service_stub.call_rpc :list_exclusions, request, options: options do |response, operation|
2598
2604
  response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_exclusions, request, response, operation, options
2599
2605
  yield response, operation if block_given?
2600
- return response
2606
+ throw :response, response
2601
2607
  end
2602
2608
  rescue ::GRPC::BadStatus => e
2603
2609
  raise ::Google::Cloud::Error.from_error(e)
@@ -2692,7 +2698,6 @@ module Google
2692
2698
 
2693
2699
  @config_service_stub.call_rpc :get_exclusion, request, options: options do |response, operation|
2694
2700
  yield response, operation if block_given?
2695
- return response
2696
2701
  end
2697
2702
  rescue ::GRPC::BadStatus => e
2698
2703
  raise ::Google::Cloud::Error.from_error(e)
@@ -2793,7 +2798,6 @@ module Google
2793
2798
 
2794
2799
  @config_service_stub.call_rpc :create_exclusion, request, options: options do |response, operation|
2795
2800
  yield response, operation if block_given?
2796
- return response
2797
2801
  end
2798
2802
  rescue ::GRPC::BadStatus => e
2799
2803
  raise ::Google::Cloud::Error.from_error(e)
@@ -2901,7 +2905,6 @@ module Google
2901
2905
 
2902
2906
  @config_service_stub.call_rpc :update_exclusion, request, options: options do |response, operation|
2903
2907
  yield response, operation if block_given?
2904
- return response
2905
2908
  end
2906
2909
  rescue ::GRPC::BadStatus => e
2907
2910
  raise ::Google::Cloud::Error.from_error(e)
@@ -2996,7 +2999,6 @@ module Google
2996
2999
 
2997
3000
  @config_service_stub.call_rpc :delete_exclusion, request, options: options do |response, operation|
2998
3001
  yield response, operation if block_given?
2999
- return response
3000
3002
  end
3001
3003
  rescue ::GRPC::BadStatus => e
3002
3004
  raise ::Google::Cloud::Error.from_error(e)
@@ -3105,7 +3107,6 @@ module Google
3105
3107
 
3106
3108
  @config_service_stub.call_rpc :get_cmek_settings, request, options: options do |response, operation|
3107
3109
  yield response, operation if block_given?
3108
- return response
3109
3110
  end
3110
3111
  rescue ::GRPC::BadStatus => e
3111
3112
  raise ::Google::Cloud::Error.from_error(e)
@@ -3232,7 +3233,6 @@ module Google
3232
3233
 
3233
3234
  @config_service_stub.call_rpc :update_cmek_settings, request, options: options do |response, operation|
3234
3235
  yield response, operation if block_given?
3235
- return response
3236
3236
  end
3237
3237
  rescue ::GRPC::BadStatus => e
3238
3238
  raise ::Google::Cloud::Error.from_error(e)
@@ -3341,7 +3341,6 @@ module Google
3341
3341
 
3342
3342
  @config_service_stub.call_rpc :get_settings, request, options: options do |response, operation|
3343
3343
  yield response, operation if block_given?
3344
- return response
3345
3344
  end
3346
3345
  rescue ::GRPC::BadStatus => e
3347
3346
  raise ::Google::Cloud::Error.from_error(e)
@@ -3466,7 +3465,6 @@ module Google
3466
3465
 
3467
3466
  @config_service_stub.call_rpc :update_settings, request, options: options do |response, operation|
3468
3467
  yield response, operation if block_given?
3469
- return response
3470
3468
  end
3471
3469
  rescue ::GRPC::BadStatus => e
3472
3470
  raise ::Google::Cloud::Error.from_error(e)
@@ -3561,7 +3559,7 @@ module Google
3561
3559
  @config_service_stub.call_rpc :copy_log_entries, request, options: options do |response, operation|
3562
3560
  response = ::Gapic::Operation.new response, @operations_client, options: options
3563
3561
  yield response, operation if block_given?
3564
- return response
3562
+ throw :response, response
3565
3563
  end
3566
3564
  rescue ::GRPC::BadStatus => e
3567
3565
  raise ::Google::Cloud::Error.from_error(e)
@@ -3650,6 +3648,11 @@ module Google
3650
3648
  # default endpoint URL. The default value of nil uses the environment
3651
3649
  # universe (usually the default "googleapis.com" universe).
3652
3650
  # @return [::String,nil]
3651
+ # @!attribute [rw] logger
3652
+ # A custom logger to use for request/response debug logging, or the value
3653
+ # `:default` (the default) to construct a default logger, or `nil` to
3654
+ # explicitly disable logging.
3655
+ # @return [::Logger,:default,nil]
3653
3656
  #
3654
3657
  class Configuration
3655
3658
  extend ::Gapic::Config
@@ -3674,6 +3677,7 @@ module Google
3674
3677
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3675
3678
  config_attr :quota_project, nil, ::String, nil
3676
3679
  config_attr :universe_domain, nil, ::String, nil
3680
+ config_attr :logger, :default, ::Logger, nil, :default
3677
3681
 
3678
3682
  # @private
3679
3683
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil
@@ -187,8 +187,28 @@ module Google
187
187
  universe_domain: @config.universe_domain,
188
188
  channel_args: @config.channel_args,
189
189
  interceptors: @config.interceptors,
190
- channel_pool_config: @config.channel_pool
190
+ channel_pool_config: @config.channel_pool,
191
+ logger: @config.logger
191
192
  )
193
+
194
+ @logging_service_stub.stub_logger&.info do |entry|
195
+ entry.set_system_name
196
+ entry.set_service
197
+ entry.message = "Created client for #{entry.service}"
198
+ entry.set_credentials_fields credentials
199
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
200
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
201
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
202
+ end
203
+ end
204
+
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @logging_service_stub.logger
192
212
  end
193
213
 
194
214
  # Service calls
@@ -288,7 +308,6 @@ module Google
288
308
 
289
309
  @logging_service_stub.call_rpc :delete_log, request, options: options do |response, operation|
290
310
  yield response, operation if block_given?
291
- return response
292
311
  end
293
312
  rescue ::GRPC::BadStatus => e
294
313
  raise ::Google::Cloud::Error.from_error(e)
@@ -439,7 +458,6 @@ module Google
439
458
 
440
459
  @logging_service_stub.call_rpc :write_log_entries, request, options: options do |response, operation|
441
460
  yield response, operation if block_given?
442
- return response
443
461
  end
444
462
  rescue ::GRPC::BadStatus => e
445
463
  raise ::Google::Cloud::Error.from_error(e)
@@ -564,7 +582,7 @@ module Google
564
582
  @logging_service_stub.call_rpc :list_log_entries, request, options: options do |response, operation|
565
583
  response = ::Gapic::PagedEnumerable.new @logging_service_stub, :list_log_entries, request, response, operation, options
566
584
  yield response, operation if block_given?
567
- return response
585
+ throw :response, response
568
586
  end
569
587
  rescue ::GRPC::BadStatus => e
570
588
  raise ::Google::Cloud::Error.from_error(e)
@@ -654,7 +672,7 @@ module Google
654
672
  @logging_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
655
673
  response = ::Gapic::PagedEnumerable.new @logging_service_stub, :list_monitored_resource_descriptors, request, response, operation, options
656
674
  yield response, operation if block_given?
657
- return response
675
+ throw :response, response
658
676
  end
659
677
  rescue ::GRPC::BadStatus => e
660
678
  raise ::Google::Cloud::Error.from_error(e)
@@ -771,7 +789,6 @@ module Google
771
789
 
772
790
  @logging_service_stub.call_rpc :list_logs, request, options: options do |response, operation|
773
791
  yield response, operation if block_given?
774
- return response
775
792
  end
776
793
  rescue ::GRPC::BadStatus => e
777
794
  raise ::Google::Cloud::Error.from_error(e)
@@ -851,7 +868,6 @@ module Google
851
868
 
852
869
  @logging_service_stub.call_rpc :tail_log_entries, request, options: options do |response, operation|
853
870
  yield response, operation if block_given?
854
- return response
855
871
  end
856
872
  rescue ::GRPC::BadStatus => e
857
873
  raise ::Google::Cloud::Error.from_error(e)
@@ -940,6 +956,11 @@ module Google
940
956
  # default endpoint URL. The default value of nil uses the environment
941
957
  # universe (usually the default "googleapis.com" universe).
942
958
  # @return [::String,nil]
959
+ # @!attribute [rw] logger
960
+ # A custom logger to use for request/response debug logging, or the value
961
+ # `:default` (the default) to construct a default logger, or `nil` to
962
+ # explicitly disable logging.
963
+ # @return [::Logger,:default,nil]
943
964
  #
944
965
  class Configuration
945
966
  extend ::Gapic::Config
@@ -964,6 +985,7 @@ module Google
964
985
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
965
986
  config_attr :quota_project, nil, ::String, nil
966
987
  config_attr :universe_domain, nil, ::String, nil
988
+ config_attr :logger, :default, ::Logger, nil, :default
967
989
 
968
990
  # @private
969
991
  def initialize parent_config = nil
@@ -179,8 +179,28 @@ module Google
179
179
  universe_domain: @config.universe_domain,
180
180
  channel_args: @config.channel_args,
181
181
  interceptors: @config.interceptors,
182
- channel_pool_config: @config.channel_pool
182
+ channel_pool_config: @config.channel_pool,
183
+ logger: @config.logger
183
184
  )
185
+
186
+ @metrics_service_stub.stub_logger&.info do |entry|
187
+ entry.set_system_name
188
+ entry.set_service
189
+ entry.message = "Created client for #{entry.service}"
190
+ entry.set_credentials_fields credentials
191
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
192
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
193
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
194
+ end
195
+ end
196
+
197
+ ##
198
+ # The logger used for request/response debug logging.
199
+ #
200
+ # @return [Logger]
201
+ #
202
+ def logger
203
+ @metrics_service_stub.logger
184
204
  end
185
205
 
186
206
  # Service calls
@@ -281,7 +301,7 @@ module Google
281
301
  @metrics_service_stub.call_rpc :list_log_metrics, request, options: options do |response, operation|
282
302
  response = ::Gapic::PagedEnumerable.new @metrics_service_stub, :list_log_metrics, request, response, operation, options
283
303
  yield response, operation if block_given?
284
- return response
304
+ throw :response, response
285
305
  end
286
306
  rescue ::GRPC::BadStatus => e
287
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -369,7 +389,6 @@ module Google
369
389
 
370
390
  @metrics_service_stub.call_rpc :get_log_metric, request, options: options do |response, operation|
371
391
  yield response, operation if block_given?
372
- return response
373
392
  end
374
393
  rescue ::GRPC::BadStatus => e
375
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -462,7 +481,6 @@ module Google
462
481
 
463
482
  @metrics_service_stub.call_rpc :create_log_metric, request, options: options do |response, operation|
464
483
  yield response, operation if block_given?
465
- return response
466
484
  end
467
485
  rescue ::GRPC::BadStatus => e
468
486
  raise ::Google::Cloud::Error.from_error(e)
@@ -556,7 +574,6 @@ module Google
556
574
 
557
575
  @metrics_service_stub.call_rpc :update_log_metric, request, options: options do |response, operation|
558
576
  yield response, operation if block_given?
559
- return response
560
577
  end
561
578
  rescue ::GRPC::BadStatus => e
562
579
  raise ::Google::Cloud::Error.from_error(e)
@@ -644,7 +661,6 @@ module Google
644
661
 
645
662
  @metrics_service_stub.call_rpc :delete_log_metric, request, options: options do |response, operation|
646
663
  yield response, operation if block_given?
647
- return response
648
664
  end
649
665
  rescue ::GRPC::BadStatus => e
650
666
  raise ::Google::Cloud::Error.from_error(e)
@@ -733,6 +749,11 @@ module Google
733
749
  # default endpoint URL. The default value of nil uses the environment
734
750
  # universe (usually the default "googleapis.com" universe).
735
751
  # @return [::String,nil]
752
+ # @!attribute [rw] logger
753
+ # A custom logger to use for request/response debug logging, or the value
754
+ # `:default` (the default) to construct a default logger, or `nil` to
755
+ # explicitly disable logging.
756
+ # @return [::Logger,:default,nil]
736
757
  #
737
758
  class Configuration
738
759
  extend ::Gapic::Config
@@ -757,6 +778,7 @@ module Google
757
778
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
758
779
  config_attr :quota_project, nil, ::String, nil
759
780
  config_attr :universe_domain, nil, ::String, nil
781
+ config_attr :logger, :default, ::Logger, nil, :default
760
782
 
761
783
  # @private
762
784
  def initialize parent_config = nil
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Logging
23
23
  module V2
24
- VERSION = "1.0.1"
24
+ VERSION = "1.1.0"
25
25
  end
26
26
  end
27
27
  end
@@ -28,6 +28,9 @@ module Google
28
28
  # @!attribute [rw] destinations
29
29
  # @return [::Array<::Google::Api::ClientLibraryDestination>]
30
30
  # The destination where API teams want this client library to be published.
31
+ # @!attribute [rw] selective_gapic_generation
32
+ # @return [::Google::Api::SelectiveGapicGeneration]
33
+ # Configuration for which RPCs should be generated in the GAPIC client.
31
34
  class CommonLanguageSettings
32
35
  include ::Google::Protobuf::MessageExts
33
36
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -212,6 +215,12 @@ module Google
212
215
  # enabled. By default, asynchronous REST clients will not be generated.
213
216
  # This feature will be enabled by default 1 month after launching the
214
217
  # feature in preview packages.
218
+ # @!attribute [rw] protobuf_pythonic_types_enabled
219
+ # @return [::Boolean]
220
+ # Enables generation of protobuf code using new types that are more
221
+ # Pythonic which are included in `protobuf>=5.29.x`. This feature will be
222
+ # enabled by default 1 month after launching the feature in preview
223
+ # packages.
215
224
  class ExperimentalFeatures
216
225
  include ::Google::Protobuf::MessageExts
217
226
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -297,9 +306,28 @@ module Google
297
306
  # @!attribute [rw] common
298
307
  # @return [::Google::Api::CommonLanguageSettings]
299
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
300
319
  class GoSettings
301
320
  include ::Google::Protobuf::MessageExts
302
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
303
331
  end
304
332
 
305
333
  # Describes the generator configuration for a method.
@@ -375,6 +403,17 @@ module Google
375
403
  end
376
404
  end
377
405
 
406
+ # This message is used to configure the generation of a subset of the RPCs in
407
+ # a service for client libraries.
408
+ # @!attribute [rw] methods
409
+ # @return [::Array<::String>]
410
+ # An allowlist of the fully qualified names of RPCs that should be included
411
+ # on public client surfaces.
412
+ class SelectiveGapicGeneration
413
+ include ::Google::Protobuf::MessageExts
414
+ extend ::Google::Protobuf::MessageExts::ClassMethods
415
+ end
416
+
378
417
  # The organization for which the client libraries are being published.
379
418
  # Affects the url where generated docs are published, etc.
380
419
  module ClientLibraryOrganization
@@ -200,9 +200,27 @@ module Google
200
200
  # The delay of data points caused by ingestion. Data points older than this
201
201
  # age are guaranteed to be ingested and available to be read, excluding
202
202
  # data loss due to errors.
203
+ # @!attribute [rw] time_series_resource_hierarchy_level
204
+ # @return [::Array<::Google::Api::MetricDescriptor::MetricDescriptorMetadata::TimeSeriesResourceHierarchyLevel>]
205
+ # The scope of the timeseries data of the metric.
203
206
  class MetricDescriptorMetadata
204
207
  include ::Google::Protobuf::MessageExts
205
208
  extend ::Google::Protobuf::MessageExts::ClassMethods
209
+
210
+ # The resource hierarchy level of the timeseries data of a metric.
211
+ module TimeSeriesResourceHierarchyLevel
212
+ # Do not use this default value.
213
+ TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0
214
+
215
+ # Scopes a metric to a project.
216
+ PROJECT = 1
217
+
218
+ # Scopes a metric to an organization.
219
+ ORGANIZATION = 2
220
+
221
+ # Scopes a metric to a folder.
222
+ FOLDER = 3
223
+ end
206
224
  end
207
225
 
208
226
  # The kind of measurement. It describes how the data is reported.
@@ -42,7 +42,7 @@ module Google
42
42
  # The error result of the operation in case of failure or cancellation.
43
43
  # @!attribute [rw] response
44
44
  # @return [::Google::Protobuf::Any]
45
- # The normal response of the operation in case of success. If the original
45
+ # The normal, successful response of the operation. If the original
46
46
  # method returns no data on success, such as `Delete`, the response is
47
47
  # `google.protobuf.Empty`. If the original method is standard
48
48
  # `Get`/`Create`/`Update`, the response should be the resource. For other
@@ -55,7 +55,8 @@ module Google
55
55
  extend ::Google::Protobuf::MessageExts::ClassMethods
56
56
  end
57
57
 
58
- # The request message for Operations.GetOperation.
58
+ # The request message for
59
+ # Operations.GetOperation.
59
60
  # @!attribute [rw] name
60
61
  # @return [::String]
61
62
  # The name of the operation resource.
@@ -64,7 +65,8 @@ module Google
64
65
  extend ::Google::Protobuf::MessageExts::ClassMethods
65
66
  end
66
67
 
67
- # The request message for Operations.ListOperations.
68
+ # The request message for
69
+ # Operations.ListOperations.
68
70
  # @!attribute [rw] name
69
71
  # @return [::String]
70
72
  # The name of the operation's parent resource.
@@ -82,7 +84,8 @@ module Google
82
84
  extend ::Google::Protobuf::MessageExts::ClassMethods
83
85
  end
84
86
 
85
- # The response message for Operations.ListOperations.
87
+ # The response message for
88
+ # Operations.ListOperations.
86
89
  # @!attribute [rw] operations
87
90
  # @return [::Array<::Google::Longrunning::Operation>]
88
91
  # A list of operations that matches the specified filter in the request.
@@ -94,7 +97,8 @@ module Google
94
97
  extend ::Google::Protobuf::MessageExts::ClassMethods
95
98
  end
96
99
 
97
- # The request message for Operations.CancelOperation.
100
+ # The request message for
101
+ # Operations.CancelOperation.
98
102
  # @!attribute [rw] name
99
103
  # @return [::String]
100
104
  # The name of the operation resource to be cancelled.
@@ -103,7 +107,8 @@ module Google
103
107
  extend ::Google::Protobuf::MessageExts::ClassMethods
104
108
  end
105
109
 
106
- # The request message for Operations.DeleteOperation.
110
+ # The request message for
111
+ # Operations.DeleteOperation.
107
112
  # @!attribute [rw] name
108
113
  # @return [::String]
109
114
  # The name of the operation resource to be deleted.
@@ -112,7 +117,8 @@ module Google
112
117
  extend ::Google::Protobuf::MessageExts::ClassMethods
113
118
  end
114
119
 
115
- # The request message for Operations.WaitOperation.
120
+ # The request message for
121
+ # Operations.WaitOperation.
116
122
  # @!attribute [rw] name
117
123
  # @return [::String]
118
124
  # The name of the operation resource to wait on.
@@ -130,13 +136,12 @@ module Google
130
136
  #
131
137
  # Example:
132
138
  #
133
- # rpc LongRunningRecognize(LongRunningRecognizeRequest)
134
- # returns (google.longrunning.Operation) {
135
- # option (google.longrunning.operation_info) = {
136
- # response_type: "LongRunningRecognizeResponse"
137
- # metadata_type: "LongRunningRecognizeMetadata"
138
- # };
139
- # }
139
+ # rpc Export(ExportRequest) returns (google.longrunning.Operation) {
140
+ # option (google.longrunning.operation_info) = {
141
+ # response_type: "ExportResponse"
142
+ # metadata_type: "ExportMetadata"
143
+ # };
144
+ # }
140
145
  # @!attribute [rw] response_type
141
146
  # @return [::String]
142
147
  # Required. The message name of the primary return type for this
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-logging-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.5.6
126
+ rubygems_version: 3.5.23
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Writes log entries and manages your Cloud Logging configuration.