google-cloud-logging 1.6.6 → 1.7.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/CHANGELOG.md +6 -0
- data/lib/google-cloud-logging.rb +1 -0
- data/lib/google/cloud/logging.rb +8 -3
- data/lib/google/cloud/logging/service.rb +36 -17
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9844d4e41540ef97cb06a18febc80c45155d6296032a532b31e26cc00a7eeca9
|
4
|
+
data.tar.gz: 5e1b5a06346223d342873406bd87cea59d441458d88192f0000a0d4e43f006d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 787ed9af979f2bdb9211ce456e06d40e05b2c397dd1a0750e228ae7dd5ccc6f6a4d0b407a3afdbed2a59a80439bb8a13745f081dd1190aa9e43887c8b70992ba
|
7
|
+
data.tar.gz: f4d201182423411533d12373d21199e659221364e5753d610cf2910b13eade54a15da8843a33867b43d771bc2d3048daeae5edac18ed1f4f19f32f4c94e33d17
|
data/CHANGELOG.md
CHANGED
data/lib/google-cloud-logging.rb
CHANGED
@@ -149,6 +149,7 @@ Google::Cloud.configure.add_config! :logging do |config|
|
|
149
149
|
config.add_field! :scope, nil, match: [String, Array]
|
150
150
|
config.add_field! :timeout, nil, match: Integer
|
151
151
|
config.add_field! :client_config, nil, match: Hash
|
152
|
+
config.add_field! :endpoint, nil, match: String
|
152
153
|
config.add_field! :log_name, nil, match: String
|
153
154
|
config.add_field! :log_name_map, nil, match: Hash
|
154
155
|
config.add_field! :labels, nil, match: Hash
|
data/lib/google/cloud/logging.rb
CHANGED
@@ -65,6 +65,8 @@ module Google
|
|
65
65
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
66
66
|
# @param [Hash] client_config A hash of values to override the default
|
67
67
|
# behavior of the API client. Optional.
|
68
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
69
|
+
# If the param is nil, uses the default endpoint.
|
68
70
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
69
71
|
# @param [String] keyfile Alias for the `credentials` argument.
|
70
72
|
# Deprecated.
|
@@ -82,11 +84,12 @@ module Google
|
|
82
84
|
# end
|
83
85
|
#
|
84
86
|
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
85
|
-
client_config: nil, project: nil, keyfile: nil
|
87
|
+
client_config: nil, endpoint: nil, project: nil, keyfile: nil
|
86
88
|
project_id ||= (project || default_project_id)
|
87
89
|
scope ||= configure.scope
|
88
90
|
timeout ||= configure.timeout
|
89
91
|
client_config ||= configure.client_config
|
92
|
+
endpoint ||= configure.endpoint
|
90
93
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
91
94
|
|
92
95
|
unless credentials.is_a? Google::Auth::Credentials
|
@@ -101,8 +104,8 @@ module Google
|
|
101
104
|
|
102
105
|
Logging::Project.new(
|
103
106
|
Logging::Service.new(
|
104
|
-
project_id, credentials,
|
105
|
-
|
107
|
+
project_id, credentials,
|
108
|
+
host: endpoint, timeout: timeout, client_config: client_config
|
106
109
|
)
|
107
110
|
)
|
108
111
|
end
|
@@ -126,6 +129,8 @@ module Google
|
|
126
129
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
127
130
|
# * `client_config` - (Hash) A hash of values to override the default
|
128
131
|
# behavior of the API client.
|
132
|
+
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
133
|
+
# to use the default endpoint.
|
129
134
|
# * `log_name` - (String) Name of the application log file. Default:
|
130
135
|
# `"ruby_app_log"`
|
131
136
|
# * `log_name_map` - (Hash) Map specific request routes to other log.
|
@@ -17,6 +17,7 @@ require "google/cloud/errors"
|
|
17
17
|
require "google/cloud/logging/version"
|
18
18
|
require "google/cloud/logging/v2"
|
19
19
|
require "google/gax/errors"
|
20
|
+
require "uri"
|
20
21
|
|
21
22
|
module Google
|
22
23
|
module Cloud
|
@@ -25,26 +26,30 @@ module Google
|
|
25
26
|
# @private Represents the gRPC Logging service, including all the API
|
26
27
|
# methods.
|
27
28
|
class Service
|
28
|
-
attr_accessor :project, :credentials, :timeout, :client_config
|
29
|
+
attr_accessor :project, :credentials, :timeout, :client_config, :host
|
29
30
|
|
30
31
|
##
|
31
32
|
# Creates a new Service instance.
|
32
|
-
def initialize project, credentials, timeout: nil, client_config: nil
|
33
|
+
def initialize project, credentials, timeout: nil, client_config: nil,
|
34
|
+
host: nil
|
33
35
|
@project = project
|
34
36
|
@credentials = credentials
|
35
37
|
@timeout = timeout
|
36
38
|
@client_config = client_config || {}
|
39
|
+
@host = host || V2::LoggingServiceV2Client::SERVICE_ADDRESS
|
37
40
|
end
|
38
41
|
|
39
42
|
def logging
|
40
43
|
return mocked_logging if mocked_logging
|
41
44
|
@logging ||= \
|
42
45
|
V2::LoggingServiceV2Client.new(
|
43
|
-
credentials:
|
44
|
-
timeout:
|
45
|
-
client_config:
|
46
|
-
|
47
|
-
|
46
|
+
credentials: credentials,
|
47
|
+
timeout: timeout,
|
48
|
+
client_config: client_config,
|
49
|
+
service_address: service_address,
|
50
|
+
service_port: service_port,
|
51
|
+
lib_name: "gccl",
|
52
|
+
lib_version: Google::Cloud::Logging::VERSION
|
48
53
|
)
|
49
54
|
end
|
50
55
|
attr_accessor :mocked_logging
|
@@ -53,11 +58,13 @@ module Google
|
|
53
58
|
return mocked_sinks if mocked_sinks
|
54
59
|
@sinks ||= \
|
55
60
|
V2::ConfigServiceV2Client.new(
|
56
|
-
credentials:
|
57
|
-
timeout:
|
58
|
-
client_config:
|
59
|
-
|
60
|
-
|
61
|
+
credentials: credentials,
|
62
|
+
timeout: timeout,
|
63
|
+
client_config: client_config,
|
64
|
+
service_address: service_address,
|
65
|
+
service_port: service_port,
|
66
|
+
lib_name: "gccl",
|
67
|
+
lib_version: Google::Cloud::Logging::VERSION
|
61
68
|
)
|
62
69
|
end
|
63
70
|
attr_accessor :mocked_sinks
|
@@ -66,11 +73,13 @@ module Google
|
|
66
73
|
return mocked_metrics if mocked_metrics
|
67
74
|
@metrics ||= \
|
68
75
|
V2::MetricsServiceV2Client.new(
|
69
|
-
credentials:
|
70
|
-
timeout:
|
71
|
-
client_config:
|
72
|
-
|
73
|
-
|
76
|
+
credentials: credentials,
|
77
|
+
timeout: timeout,
|
78
|
+
client_config: client_config,
|
79
|
+
service_address: service_address,
|
80
|
+
service_port: service_port,
|
81
|
+
lib_name: "gccl",
|
82
|
+
lib_version: Google::Cloud::Logging::VERSION
|
74
83
|
)
|
75
84
|
end
|
76
85
|
attr_accessor :mocked_metrics
|
@@ -271,6 +280,16 @@ module Google
|
|
271
280
|
|
272
281
|
protected
|
273
282
|
|
283
|
+
def service_address
|
284
|
+
return nil if host.nil?
|
285
|
+
URI.parse("//#{host}").host
|
286
|
+
end
|
287
|
+
|
288
|
+
def service_port
|
289
|
+
return nil if host.nil?
|
290
|
+
URI.parse("//#{host}").port
|
291
|
+
end
|
292
|
+
|
274
293
|
def project_path
|
275
294
|
"projects/#{@project}"
|
276
295
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-08-
|
12
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|