Skip to content

Commit 0da0307

Browse files
authored
feat: add logging for HTTP requests (#106)
1 parent 3910378 commit 0da0307

21 files changed

+183
-640
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ docs
1818
bin/generated/
1919
bin/cloud.yml
2020
bin/oss.yml
21+
bin/invocable-scripts.yml
2122
bin/influxdb-clients-apigen/

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 2.7.0 [unreleased]
22

3+
### Features
4+
1. [#106](https://github.com/influxdata/influxdb-client-ruby/pull/106): Add logging for HTTP requests
5+
36
## 2.6.0 [2022-06-24]
47

58
### Bug Fixes

README.md

+37-35
Large diffs are not rendered by default.

apis/lib/influxdb2/apis/api.rb

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def initialize(client)
4343
# Token
4444
configuration.api_key_prefix['api_key'] = 'Token'
4545
configuration.api_key['api_key'] = client.options[:token]
46+
# Debugging
47+
configuration.debugging = client.options[:debugging]
48+
configuration.logger = client.options[:logger]
4649

4750
@api_client = ApiClient.new(configuration)
4851
# User Agent

apis/lib/influxdb2/apis/generated/api/authorizations_api.rb

-30
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ def delete_authorizations_id(auth_id, opts = {})
3434
# @option opts [String] :zap_trace_span OpenTracing span context
3535
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
3636
def delete_authorizations_id_with_http_info(auth_id, opts = {})
37-
if @api_client.config.debugging
38-
@api_client.config.logger.debug 'Calling API: AuthorizationsApi.delete_authorizations_id ...'
39-
end
4037
# verify the required parameter 'auth_id' is set
4138
if @api_client.config.client_side_validation && auth_id.nil?
4239
fail ArgumentError, "Missing the required parameter 'auth_id' when calling AuthorizationsApi.delete_authorizations_id"
@@ -76,9 +73,6 @@ def delete_authorizations_id_with_http_info(auth_id, opts = {})
7673
)
7774

7875
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
79-
if @api_client.config.debugging
80-
@api_client.config.logger.debug "API called: AuthorizationsApi#delete_authorizations_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81-
end
8276
return data, status_code, headers
8377
end
8478

@@ -104,9 +98,6 @@ def get_authorizations(opts = {})
10498
# @option opts [String] :org Only show authorizations that belong to a organization name.
10599
# @return [Array<(Authorizations, Integer, Hash)>] Authorizations data, response status code and response headers
106100
def get_authorizations_with_http_info(opts = {})
107-
if @api_client.config.debugging
108-
@api_client.config.logger.debug 'Calling API: AuthorizationsApi.get_authorizations ...'
109-
end
110101
# resource path
111102
local_var_path = '/authorizations'
112103

@@ -146,9 +137,6 @@ def get_authorizations_with_http_info(opts = {})
146137
)
147138

148139
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
149-
if @api_client.config.debugging
150-
@api_client.config.logger.debug "API called: AuthorizationsApi#get_authorizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151-
end
152140
return data, status_code, headers
153141
end
154142

@@ -168,9 +156,6 @@ def get_authorizations_id(auth_id, opts = {})
168156
# @option opts [String] :zap_trace_span OpenTracing span context
169157
# @return [Array<(Authorization, Integer, Hash)>] Authorization data, response status code and response headers
170158
def get_authorizations_id_with_http_info(auth_id, opts = {})
171-
if @api_client.config.debugging
172-
@api_client.config.logger.debug 'Calling API: AuthorizationsApi.get_authorizations_id ...'
173-
end
174159
# verify the required parameter 'auth_id' is set
175160
if @api_client.config.client_side_validation && auth_id.nil?
176161
fail ArgumentError, "Missing the required parameter 'auth_id' when calling AuthorizationsApi.get_authorizations_id"
@@ -210,9 +195,6 @@ def get_authorizations_id_with_http_info(auth_id, opts = {})
210195
)
211196

212197
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
213-
if @api_client.config.debugging
214-
@api_client.config.logger.debug "API called: AuthorizationsApi#get_authorizations_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
215-
end
216198
return data, status_code, headers
217199
end
218200

@@ -234,9 +216,6 @@ def patch_authorizations_id(auth_id, authorization_update_request, opts = {})
234216
# @option opts [String] :zap_trace_span OpenTracing span context
235217
# @return [Array<(Authorization, Integer, Hash)>] Authorization data, response status code and response headers
236218
def patch_authorizations_id_with_http_info(auth_id, authorization_update_request, opts = {})
237-
if @api_client.config.debugging
238-
@api_client.config.logger.debug 'Calling API: AuthorizationsApi.patch_authorizations_id ...'
239-
end
240219
# verify the required parameter 'auth_id' is set
241220
if @api_client.config.client_side_validation && auth_id.nil?
242221
fail ArgumentError, "Missing the required parameter 'auth_id' when calling AuthorizationsApi.patch_authorizations_id"
@@ -282,9 +261,6 @@ def patch_authorizations_id_with_http_info(auth_id, authorization_update_request
282261
)
283262

284263
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
285-
if @api_client.config.debugging
286-
@api_client.config.logger.debug "API called: AuthorizationsApi#patch_authorizations_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
287-
end
288264
return data, status_code, headers
289265
end
290266

@@ -304,9 +280,6 @@ def post_authorizations(authorization_post_request, opts = {})
304280
# @option opts [String] :zap_trace_span OpenTracing span context
305281
# @return [Array<(Authorization, Integer, Hash)>] Authorization data, response status code and response headers
306282
def post_authorizations_with_http_info(authorization_post_request, opts = {})
307-
if @api_client.config.debugging
308-
@api_client.config.logger.debug 'Calling API: AuthorizationsApi.post_authorizations ...'
309-
end
310283
# verify the required parameter 'authorization_post_request' is set
311284
if @api_client.config.client_side_validation && authorization_post_request.nil?
312285
fail ArgumentError, "Missing the required parameter 'authorization_post_request' when calling AuthorizationsApi.post_authorizations"
@@ -348,9 +321,6 @@ def post_authorizations_with_http_info(authorization_post_request, opts = {})
348321
)
349322

350323
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
351-
if @api_client.config.debugging
352-
@api_client.config.logger.debug "API called: AuthorizationsApi#post_authorizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
353-
end
354324
return data, status_code, headers
355325
end
356326
end

0 commit comments

Comments
 (0)