Skip to content

Commit 5567d2e

Browse files
authored
Feature/improve logs and add verbose (#11)
* update transport logging: add verbose params don't log error for exists methods move ignore to opts var * update version * fix review comments
1 parent 72f0a95 commit 5567d2e

File tree

25 files changed

+166
-90
lines changed

25 files changed

+166
-90
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
name = "ElasticsearchClient"
22
uuid = "e586a49d-aa29-4ce5-8f91-fa4f824367bd"
33
authors = ["Egor Shmorgun <egor.shmorgun@opensesame.com>"]
4-
version = "0.2.8"
4+
version = "0.2.9"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
1010
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
11+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1112
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
1213
Retry = "20febd7b-183b-5ae2-ac4a-720e7ce64774"
1314
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
1415

1516
[compat]
16-
julia = "1"
1717
CodecZlib = "0.7"
1818
HTTP = "1"
1919
JSON = "0.21"
2020
Mocking = "0.7"
2121
Retry = "0.4"
2222
URIs = "1"
23+
julia = "1"
2324

2425
[extras]
2526
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/api/actions/bulk.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function bulk(client::Client; body, index=nothing, headers=Dict(), auth_params=n
2727
else
2828
"/_bulk"
2929
end
30+
options = extract_options(arguments)
3031
params = process_params(arguments)
3132

3233
payload = if body isa Vector
@@ -36,6 +37,6 @@ function bulk(client::Client; body, index=nothing, headers=Dict(), auth_params=n
3637
end
3738

3839
Response(
39-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=payload)
40+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=payload, opts=options)
4041
)
41-
end
42+
end

src/api/actions/cat/Cat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Cat
22

33
using ..API: HTTP_GET
4-
using ..API: _listify, process_params
4+
using ..API: _listify, process_params, extract_options
55
using ..API: Response
66
using ..ElasticTransport
77

src/api/actions/cat/indices.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ function indices(client::Client; index=nothing, headers=Dict(), auth_params=noth
3131
"/_cat/indices"
3232
end
3333

34+
options = extract_options(arguments)
3435
params = process_params(arguments)
3536

3637
Response(
37-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing)
38+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing, opts=options)
3839
)
3940
end

src/api/actions/delete.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ function delete(client::Client; index, id, headers=Dict(), auth_params=nothing,
2323
method = HTTP_DELETE
2424

2525
path = "/$(_listify(index))/_doc/$(_listify(id))"
26+
27+
options = extract_options(arguments)
2628
params = process_params(arguments)
2729

2830
Response(
29-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing)
31+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing, opts=options)
3032
)
3133
end

src/api/actions/delete_by_query.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ function delete_by_query(client::Client; body, index, headers=Dict(), auth_param
4444
method = HTTP_POST
4545

4646
path = "/$(_listify(index))/_delete_by_query"
47+
options = extract_options(arguments)
4748
params = process_params(arguments)
4849

4950
Response(
50-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body)
51+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body, opts=options)
5152
)
52-
end
53+
end

src/api/actions/index.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ function index(client::Client; body, index, id=nothing, headers=Dict(), auth_par
3131
else
3232
"/$(_listify(index))/_doc"
3333
end
34+
35+
options = extract_options(arguments)
3436
params = process_params(arguments)
3537

3638
Response(
37-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body)
39+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body, opts=options)
3840
)
3941
end

src/api/actions/indices/Indices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Indices
22

33
using ..API: HTTP_GET, HTTP_DELETE, HTTP_PUT, HTTP_HEAD, HTTP_POST
4-
using ..API: _listify, process_params
4+
using ..API: _listify, process_params, extract_options, set_ignore_on_not_found!
55
using ..API: Response
66
using ..ElasticTransport
77

src/api/actions/indices/create.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ function create(client::Client; body=nothing, index, headers=Dict(), auth_params
1717

1818
method = HTTP_PUT
1919
path = "/$(_listify(index))"
20+
options = extract_options(arguments)
2021
params = process_params(arguments)
2122

2223
Response(
23-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body)
24+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=body, opts=options)
2425
)
25-
end
26+
end

src/api/actions/indices/delete.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ function delete(client::Client; index, headers=Dict(), auth_params=nothing, kwar
1818

1919
method = HTTP_DELETE
2020
path = "/$(_listify(index))"
21+
options = extract_options(arguments)
2122
params = process_params(arguments)
2223

2324
Response(
24-
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing)
25+
@mock perform_request(client, method, path; params=params, auth_params=auth_params, headers=headers, body=nothing, opts=options)
2526
)
2627
end

0 commit comments

Comments
 (0)