Skip to content

Commit 742dbd6

Browse files
committed
fix took field in log response
1 parent f36883f commit 742dbd6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ElasticsearchClient"
22
uuid = "e586a49d-aa29-4ce5-8f91-fa4f824367bd"
33
authors = ["Egor Shmorgun <egor.shmorgun@opensesame.com>"]
4-
version = "0.2.10"
4+
version = "0.2.11"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"

src/elastic_transport/transport/transport.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ function perform_request(
252252

253253
if !isempty(response_body) && !isnothing(response_content_type) && !isnothing(match(r"json"i, response_content_type))
254254
json = transport.deserializer(response_body)
255-
took = if json isa Dict
256-
get(json, "took", "n/a")
255+
if json isa AbstractDict
256+
took = get(() -> get(json, :took, "n/a"), json, "took")
257257
end
258258
end
259259

@@ -302,7 +302,7 @@ end
302302
function log_response(method, body, url, response_status, response_body, took, duration, verbose; message_level=Logging.Info)
303303
sanitized_url = replace(url, r"//(.+):(.+)@" => s"//\1:$SANITIZED_PASSWORD@")
304304
log_message(
305-
"$(uppercase(method)) $sanitized_url [status:$(response_status), request:$(duration), query:$(took)]",
305+
"$(uppercase(method)) $sanitized_url [status:$(response_status), request:$(duration), elastic query: $(took)]",
306306
message_level,
307307
verbose
308308
)

0 commit comments

Comments
 (0)