google-cloud-logging 1.10.7 → 2.2.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 +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +47 -0
- data/CONTRIBUTING.md +2 -2
- data/LOGGING.md +1 -1
- data/lib/google-cloud-logging.rb +15 -15
- data/lib/google/cloud/logging.rb +12 -13
- data/lib/google/cloud/logging/async_writer.rb +5 -4
- data/lib/google/cloud/logging/convert.rb +12 -7
- data/lib/google/cloud/logging/credentials.rb +2 -2
- data/lib/google/cloud/logging/entry.rb +5 -5
- data/lib/google/cloud/logging/entry/http_request.rb +5 -4
- data/lib/google/cloud/logging/entry/list.rb +4 -4
- data/lib/google/cloud/logging/entry/operation.rb +5 -4
- data/lib/google/cloud/logging/entry/source_location.rb +5 -4
- data/lib/google/cloud/logging/log/list.rb +4 -4
- data/lib/google/cloud/logging/logger.rb +7 -15
- data/lib/google/cloud/logging/metric.rb +2 -2
- data/lib/google/cloud/logging/metric/list.rb +4 -4
- data/lib/google/cloud/logging/middleware.rb +2 -2
- data/lib/google/cloud/logging/project.rb +1 -1
- data/lib/google/cloud/logging/rails.rb +7 -10
- data/lib/google/cloud/logging/resource_descriptor/list.rb +4 -4
- data/lib/google/cloud/logging/service.rb +73 -173
- data/lib/google/cloud/logging/sink.rb +2 -2
- data/lib/google/cloud/logging/sink/list.rb +4 -4
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +14 -84
- data/lib/google/cloud/logging/v2.rb +0 -18
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +0 -1368
- data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +0 -106
- data/lib/google/cloud/logging/v2/credentials.rb +0 -39
- data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +0 -164
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +0 -42
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +0 -233
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +0 -85
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +0 -86
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +0 -179
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +0 -238
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +0 -660
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +0 -220
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +0 -680
- data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +0 -61
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +0 -475
- data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +0 -56
- data/lib/google/logging/v2/log_entry_pb.rb +0 -59
- data/lib/google/logging/v2/logging_config_pb.rb +0 -173
- data/lib/google/logging/v2/logging_config_services_pb.rb +0 -112
- data/lib/google/logging/v2/logging_metrics_pb.rb +0 -72
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +0 -52
- data/lib/google/logging/v2/logging_pb.rb +0 -80
- data/lib/google/logging/v2/logging_services_pb.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bebb4573f1d510e3c8c6d007a92edbafcdf06c1c1a545791429541e7ee1c3db
|
4
|
+
data.tar.gz: 69f4fff5db4ac937df49ee56b7b93fbcf55e4041610f84f318f56e70703fca6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a37da884d7f7f6bd6f7f908f907feda49b59894d7f1534d7b474c77e39e371ea96894185e9921e0a07166f70e2980fb0fc33852679c2dcf440d33cfa8bffdf0
|
7
|
+
data.tar.gz: c01f22ade5fd8c14957446b4e372f6e9476cb77c17b54a91079b86556156a5a6201e4cac80a5459fcaf34d791f623fb45396bd6cd643a57d29065d01cbea44a5
|
data/AUTHENTICATION.md
CHANGED
@@ -76,7 +76,8 @@ The environment variables that google-cloud-logging checks for project ID are:
|
|
76
76
|
1. `LOGGING_PROJECT`
|
77
77
|
2. `GOOGLE_CLOUD_PROJECT`
|
78
78
|
|
79
|
-
The environment variables that google-cloud-logging checks for credentials are
|
79
|
+
The environment variables that google-cloud-logging checks for credentials are
|
80
|
+
configured on `Google::Cloud::Logging::V2::LoggingService::Credentials`:
|
80
81
|
|
81
82
|
1. `LOGGING_CREDENTIALS` - Path to JSON file, or JSON contents
|
82
83
|
2. `LOGGING_KEYFILE` - Path to JSON file, or JSON contents
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,52 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.2.0 / 2021-03-10
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
8
|
+
|
9
|
+
### 2.1.0 / 2020-09-16
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* quota_project can be set via library configuration
|
14
|
+
|
15
|
+
### 2.0.0 / 2020-07-21
|
16
|
+
|
17
|
+
This is a major update that removes the "low-level" client interface code, and
|
18
|
+
instead adds the new `google-cloud-logging-v2` gem as a dependency.
|
19
|
+
The new dependency is a rewritten low-level client, produced by a next-
|
20
|
+
generation client code generator, with improved performance and stability.
|
21
|
+
|
22
|
+
This change should have no effect on the high-level interface that most users
|
23
|
+
will use. The one exception is that the (mostly undocumented) `client_config`
|
24
|
+
argument, for adjusting low-level parameters such as RPC retry settings on
|
25
|
+
client objects, has been removed. If you need to adjust these parameters, use
|
26
|
+
the configuration interface in `google-cloud-logging-v2`.
|
27
|
+
|
28
|
+
Substantial changes have been made in the low-level interfaces, however. If you
|
29
|
+
are using the low-level classes under the `Google::Cloud::Logging::V2` module,
|
30
|
+
please review the docs for the new `google-cloud-logging-v2` gem. In
|
31
|
+
particular:
|
32
|
+
|
33
|
+
* Some classes have been renamed, notably the client class itself.
|
34
|
+
* The client constructor takes a configuration block instead of configuration
|
35
|
+
keyword arguments.
|
36
|
+
* All RPC method arguments are now keyword arguments.
|
37
|
+
|
38
|
+
### 1.10.9 / 2020-06-17
|
39
|
+
|
40
|
+
#### Documentation
|
41
|
+
|
42
|
+
* Improved field descriptions in the low-level interface.
|
43
|
+
|
44
|
+
### 1.10.8 / 2020-06-12
|
45
|
+
|
46
|
+
#### Documentation
|
47
|
+
|
48
|
+
* Provide more details on low-level monitored resource data types
|
49
|
+
|
3
50
|
### 1.10.7 / 2020-05-28
|
4
51
|
|
5
52
|
#### Documentation
|
data/CONTRIBUTING.md
CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-logging console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-logging requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-logging requires Ruby 2.5+. You may choose to
|
28
28
|
manage your Ruby and gem installations with [RVM](https://rvm.io/),
|
29
29
|
[rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
@@ -45,7 +45,7 @@ there is a small amount of setup:
|
|
45
45
|
|
46
46
|
```sh
|
47
47
|
$ cd google-cloud-logging/
|
48
|
-
$ bundle
|
48
|
+
$ bundle install
|
49
49
|
```
|
50
50
|
|
51
51
|
## Console
|
data/LOGGING.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
To enable logging for this library, set the logger for the underlying
|
4
4
|
[gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
|
5
5
|
that you set may be a Ruby stdlib
|
6
|
-
[`Logger`](https://ruby-doc.org/stdlib
|
6
|
+
[`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
|
7
7
|
shown below, or a
|
8
8
|
[`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
9
9
|
that will write logs to [Stackdriver
|
data/lib/google-cloud-logging.rb
CHANGED
@@ -43,8 +43,6 @@ module Google
|
|
43
43
|
# * `https://www.googleapis.com/auth/logging.admin`
|
44
44
|
#
|
45
45
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
46
|
-
# @param [Hash] client_config A hash of values to override the default
|
47
|
-
# behavior of the API client. Optional.
|
48
46
|
#
|
49
47
|
# @return [Google::Cloud::Logging::Project]
|
50
48
|
#
|
@@ -66,11 +64,10 @@ module Google
|
|
66
64
|
# platform_scope = "https://www.googleapis.com/auth/cloud-platform"
|
67
65
|
# logging = gcloud.logging scope: platform_scope
|
68
66
|
#
|
69
|
-
def logging scope: nil, timeout: nil
|
67
|
+
def logging scope: nil, timeout: nil
|
70
68
|
timeout ||= @timeout
|
71
|
-
Google::Cloud.logging @project, @keyfile, scope:
|
72
|
-
timeout:
|
73
|
-
client_config: client_config
|
69
|
+
Google::Cloud.logging @project, @keyfile, scope: scope,
|
70
|
+
timeout: timeout
|
74
71
|
end
|
75
72
|
|
76
73
|
##
|
@@ -96,8 +93,6 @@ module Google
|
|
96
93
|
# * `https://www.googleapis.com/auth/logging.admin`
|
97
94
|
#
|
98
95
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
99
|
-
# @param [Hash] client_config A hash of values to override the default
|
100
|
-
# behavior of the API client. Optional.
|
101
96
|
#
|
102
97
|
# @return [Google::Cloud::Logging::Project]
|
103
98
|
#
|
@@ -111,13 +106,11 @@ module Google
|
|
111
106
|
# puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
|
112
107
|
# end
|
113
108
|
#
|
114
|
-
def self.logging project_id = nil, credentials = nil, scope: nil,
|
115
|
-
timeout: nil, client_config: nil
|
109
|
+
def self.logging project_id = nil, credentials = nil, scope: nil, timeout: nil
|
116
110
|
require "google/cloud/logging"
|
117
111
|
Google::Cloud::Logging.new project_id: project_id,
|
118
112
|
credentials: credentials,
|
119
|
-
scope: scope, timeout: timeout
|
120
|
-
client_config: client_config
|
113
|
+
scope: scope, timeout: timeout
|
121
114
|
end
|
122
115
|
end
|
123
116
|
end
|
@@ -139,6 +132,13 @@ Google::Cloud.configure.add_config! :logging do |config|
|
|
139
132
|
"LOGGING_CREDENTIALS", "LOGGING_CREDENTIALS_JSON",
|
140
133
|
"LOGGING_KEYFILE", "LOGGING_KEYFILE_JSON"
|
141
134
|
end
|
135
|
+
default_scopes = [
|
136
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
137
|
+
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
138
|
+
"https://www.googleapis.com/auth/logging.admin",
|
139
|
+
"https://www.googleapis.com/auth/logging.read",
|
140
|
+
"https://www.googleapis.com/auth/logging.write"
|
141
|
+
]
|
142
142
|
|
143
143
|
config.add_field! :project_id, default_project, match: String, allow_nil: true
|
144
144
|
config.add_alias! :project, :project_id
|
@@ -146,10 +146,10 @@ Google::Cloud.configure.add_config! :logging do |config|
|
|
146
146
|
match: [String, Hash, Google::Auth::Credentials],
|
147
147
|
allow_nil: true
|
148
148
|
config.add_alias! :keyfile, :credentials
|
149
|
-
config.add_field! :scope,
|
149
|
+
config.add_field! :scope, default_scopes, match: [String, Array]
|
150
|
+
config.add_field! :quota_project, nil, match: String
|
150
151
|
config.add_field! :timeout, nil, match: Integer
|
151
|
-
config.add_field! :
|
152
|
-
config.add_field! :endpoint, nil, match: String
|
152
|
+
config.add_field! :endpoint, "logging.googleapis.com", match: String
|
153
153
|
config.add_field! :log_name, nil, match: String
|
154
154
|
config.add_field! :log_name_map, nil, match: Hash
|
155
155
|
config.add_field! :labels, nil, match: Hash
|
data/lib/google/cloud/logging.rb
CHANGED
@@ -63,8 +63,6 @@ module Google
|
|
63
63
|
# * `https://www.googleapis.com/auth/logging.admin`
|
64
64
|
#
|
65
65
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
66
|
-
# @param [Hash] client_config A hash of values to override the default
|
67
|
-
# behavior of the API client. Optional.
|
68
66
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
69
67
|
# If the param is nil, uses the default endpoint.
|
70
68
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
@@ -83,12 +81,16 @@ module Google
|
|
83
81
|
# puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
|
84
82
|
# end
|
85
83
|
#
|
86
|
-
def self.new project_id: nil,
|
87
|
-
|
84
|
+
def self.new project_id: nil,
|
85
|
+
credentials: nil,
|
86
|
+
scope: nil,
|
87
|
+
timeout: nil,
|
88
|
+
endpoint: nil,
|
89
|
+
project: nil,
|
90
|
+
keyfile: nil
|
88
91
|
project_id ||= (project || default_project_id)
|
89
92
|
scope ||= configure.scope
|
90
93
|
timeout ||= configure.timeout
|
91
|
-
client_config ||= configure.client_config
|
92
94
|
endpoint ||= configure.endpoint
|
93
95
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
94
96
|
|
@@ -102,12 +104,8 @@ module Google
|
|
102
104
|
project_id = project_id.to_s # Always cast to a string
|
103
105
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
104
106
|
|
105
|
-
Logging::
|
106
|
-
|
107
|
-
project_id, credentials,
|
108
|
-
host: endpoint, timeout: timeout, client_config: client_config
|
109
|
-
)
|
110
|
-
)
|
107
|
+
service = Logging::Service.new project_id, credentials, host: endpoint, timeout: timeout
|
108
|
+
Logging::Project.new service
|
111
109
|
end
|
112
110
|
|
113
111
|
##
|
@@ -127,8 +125,6 @@ module Google
|
|
127
125
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
128
126
|
# the set of resources and operations that the connection can access.
|
129
127
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
130
|
-
# * `client_config` - (Hash) A hash of values to override the default
|
131
|
-
# behavior of the API client.
|
132
128
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
133
129
|
# to use the default endpoint.
|
134
130
|
# * `log_name` - (String) Name of the application log file. Default:
|
@@ -186,4 +182,7 @@ module Google
|
|
186
182
|
end
|
187
183
|
end
|
188
184
|
end
|
185
|
+
|
186
|
+
# @private
|
187
|
+
Logging = Cloud::Logging unless const_defined? :Logging
|
189
188
|
end
|
@@ -65,7 +65,7 @@ module Google
|
|
65
65
|
|
66
66
|
##
|
67
67
|
# @private Creates a new AsyncWriter instance.
|
68
|
-
def initialize logging, max_count:
|
68
|
+
def initialize logging, max_count: 10_000, max_bytes: 10_000_000,
|
69
69
|
max_queue: 100, interval: 5, threads: 10,
|
70
70
|
partial_success: false
|
71
71
|
# init MonitorMixin
|
@@ -210,7 +210,7 @@ module Google
|
|
210
210
|
@stopped = true
|
211
211
|
publish_batch!
|
212
212
|
@cond.broadcast
|
213
|
-
@thread_pool
|
213
|
+
@thread_pool&.shutdown
|
214
214
|
end
|
215
215
|
|
216
216
|
self
|
@@ -457,7 +457,8 @@ module Google
|
|
457
457
|
##
|
458
458
|
# @private
|
459
459
|
class Batch
|
460
|
-
attr_reader :created_at
|
460
|
+
attr_reader :created_at
|
461
|
+
attr_reader :entries
|
461
462
|
|
462
463
|
def initialize writer
|
463
464
|
@writer = writer
|
@@ -499,7 +500,7 @@ module Google
|
|
499
500
|
|
500
501
|
def publish_wait
|
501
502
|
publish_wait = publish_at - Time.now
|
502
|
-
return 0 if publish_wait
|
503
|
+
return 0 if publish_wait.negative?
|
503
504
|
publish_wait
|
504
505
|
end
|
505
506
|
|
@@ -39,14 +39,19 @@ module Google
|
|
39
39
|
# @private Convert an Object to a Google::Protobuf::Value.
|
40
40
|
def self.object_to_value obj
|
41
41
|
case obj
|
42
|
-
when NilClass
|
43
|
-
|
44
|
-
when
|
45
|
-
|
46
|
-
when
|
47
|
-
|
42
|
+
when NilClass
|
43
|
+
Google::Protobuf::Value.new null_value: :NULL_VALUE
|
44
|
+
when Numeric
|
45
|
+
Google::Protobuf::Value.new number_value: obj
|
46
|
+
when String
|
47
|
+
Google::Protobuf::Value.new string_value: obj
|
48
|
+
when TrueClass
|
49
|
+
Google::Protobuf::Value.new bool_value: true
|
50
|
+
when FalseClass
|
51
|
+
Google::Protobuf::Value.new bool_value: false
|
52
|
+
when Hash
|
48
53
|
Google::Protobuf::Value.new struct_value: hash_to_struct(obj)
|
49
|
-
when Array
|
54
|
+
when Array
|
50
55
|
Google::Protobuf::Value.new list_value: array_to_list(obj)
|
51
56
|
else
|
52
57
|
# TODO: Could raise ArgumentError here, or convert to a string
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "google/cloud/logging/v2/credentials"
|
16
|
+
require "google/cloud/logging/v2/logging_service/credentials"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
@@ -37,7 +37,7 @@ module Google
|
|
37
37
|
#
|
38
38
|
# logging.project_id #=> "my-project"
|
39
39
|
#
|
40
|
-
class Credentials < Google::Cloud::Logging::V2::Credentials
|
40
|
+
class Credentials < Google::Cloud::Logging::V2::LoggingService::Credentials
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -422,9 +422,9 @@ module Google
|
|
422
422
|
end
|
423
423
|
|
424
424
|
##
|
425
|
-
# @private Exports the Entry to a Google::Logging::V2::LogEntry object.
|
425
|
+
# @private Exports the Entry to a Google::Cloud::Logging::V2::LogEntry object.
|
426
426
|
def to_grpc
|
427
|
-
grpc = Google::Logging::V2::LogEntry.new(
|
427
|
+
grpc = Google::Cloud::Logging::V2::LogEntry.new(
|
428
428
|
log_name: log_name.to_s,
|
429
429
|
timestamp: timestamp_grpc,
|
430
430
|
# TODO: verify severity is the correct type?
|
@@ -444,7 +444,7 @@ module Google
|
|
444
444
|
end
|
445
445
|
|
446
446
|
##
|
447
|
-
# @private New Entry from a Google::Logging::V2::LogEntry object.
|
447
|
+
# @private New Entry from a Google::Cloud::Logging::V2::LogEntry object.
|
448
448
|
def self.from_grpc grpc
|
449
449
|
return new if grpc.nil?
|
450
450
|
new.tap do |e|
|
@@ -483,7 +483,7 @@ module Google
|
|
483
483
|
|
484
484
|
##
|
485
485
|
# @private Formats the labels so they can be saved to a
|
486
|
-
# Google::Logging::V2::LogEntry object.
|
486
|
+
# Google::Cloud::Logging::V2::LogEntry object.
|
487
487
|
def labels_grpc
|
488
488
|
return {} if labels.nil?
|
489
489
|
# Coerce symbols to strings
|
@@ -494,7 +494,7 @@ module Google
|
|
494
494
|
end
|
495
495
|
|
496
496
|
##
|
497
|
-
# @private Adds the payload data to a Google::Logging::V2::LogEntry
|
497
|
+
# @private Adds the payload data to a Google::Cloud::Logging::V2::LogEntry
|
498
498
|
# object.
|
499
499
|
def append_payload grpc
|
500
500
|
grpc.proto_payload = nil
|
@@ -27,7 +27,8 @@ module Google
|
|
27
27
|
class HttpRequest
|
28
28
|
##
|
29
29
|
# @private Create an empty HttpRequest object.
|
30
|
-
def initialize
|
30
|
+
def initialize
|
31
|
+
end
|
31
32
|
|
32
33
|
##
|
33
34
|
# The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
|
@@ -125,10 +126,10 @@ module Google
|
|
125
126
|
|
126
127
|
##
|
127
128
|
# @private Exports the HttpRequest to a
|
128
|
-
# Google::Logging::Type::HttpRequest object.
|
129
|
+
# Google::Cloud::Logging::Type::HttpRequest object.
|
129
130
|
def to_grpc
|
130
131
|
return nil if empty?
|
131
|
-
Google::Logging::Type::HttpRequest.new(
|
132
|
+
Google::Cloud::Logging::Type::HttpRequest.new(
|
132
133
|
request_method: request_method.to_s,
|
133
134
|
request_url: url.to_s,
|
134
135
|
request_size: size.to_i,
|
@@ -143,7 +144,7 @@ module Google
|
|
143
144
|
end
|
144
145
|
|
145
146
|
##
|
146
|
-
# @private New HttpRequest from a Google::Logging::Type::HttpRequest
|
147
|
+
# @private New HttpRequest from a Google::Cloud::Logging::Type::HttpRequest
|
147
148
|
# object.
|
148
149
|
def self.from_grpc grpc
|
149
150
|
return new if grpc.nil?
|
@@ -126,17 +126,17 @@ module Google
|
|
126
126
|
# puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
|
127
127
|
# end
|
128
128
|
#
|
129
|
-
def all request_limit: nil
|
129
|
+
def all request_limit: nil, &block
|
130
130
|
request_limit = request_limit.to_i if request_limit
|
131
131
|
unless block_given?
|
132
132
|
return enum_for :all, request_limit: request_limit
|
133
133
|
end
|
134
134
|
results = self
|
135
135
|
loop do
|
136
|
-
results.each
|
136
|
+
results.each(&block)
|
137
137
|
if request_limit
|
138
138
|
request_limit -= 1
|
139
|
-
break if request_limit
|
139
|
+
break if request_limit.negative?
|
140
140
|
end
|
141
141
|
break unless results.next?
|
142
142
|
results = results.next
|
@@ -145,7 +145,7 @@ module Google
|
|
145
145
|
|
146
146
|
##
|
147
147
|
# @private New Entry::List from a
|
148
|
-
# Google::Logging::V2::ListLogEntryResponse object.
|
148
|
+
# Google::Cloud::Logging::V2::ListLogEntryResponse object.
|
149
149
|
def self.from_grpc grpc_list, service, resources: nil, filter: nil,
|
150
150
|
order: nil, max: nil, projects: nil
|
151
151
|
entries = new(Array(grpc_list.entries).map do |grpc_entry|
|
@@ -28,7 +28,8 @@ module Google
|
|
28
28
|
class Operation
|
29
29
|
##
|
30
30
|
# @private Create an empty Operation object.
|
31
|
-
def initialize
|
31
|
+
def initialize
|
32
|
+
end
|
32
33
|
|
33
34
|
##
|
34
35
|
# An arbitrary operation identifier. Log entries with the same
|
@@ -61,10 +62,10 @@ module Google
|
|
61
62
|
|
62
63
|
##
|
63
64
|
# @private Exports the Operation to a
|
64
|
-
# Google::Logging::V2::LogEntryOperation object.
|
65
|
+
# Google::Cloud::Logging::V2::LogEntryOperation object.
|
65
66
|
def to_grpc
|
66
67
|
return nil if empty?
|
67
|
-
Google::Logging::V2::LogEntryOperation.new(
|
68
|
+
Google::Cloud::Logging::V2::LogEntryOperation.new(
|
68
69
|
id: id.to_s,
|
69
70
|
producer: producer.to_s,
|
70
71
|
first: !(!first),
|
@@ -74,7 +75,7 @@ module Google
|
|
74
75
|
|
75
76
|
##
|
76
77
|
# @private New Google::Cloud::Logging::Entry::Operation from a
|
77
|
-
# Google::Logging::V2::LogEntryOperation object.
|
78
|
+
# Google::Cloud::Logging::V2::LogEntryOperation object.
|
78
79
|
def self.from_grpc grpc
|
79
80
|
return new if grpc.nil?
|
80
81
|
new.tap do |o|
|