From 3b40015c844b5d6f408c7938018e743a83bbd407 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Wed, 6 Sep 2023 09:45:50 -0600 Subject: [PATCH] Hijack global logger --- Project.toml | 1 + src/rest.jl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5baaeea..bd62f60 100644 --- a/Project.toml +++ b/Project.toml @@ -11,6 +11,7 @@ EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" ExceptionUnwrapping = "460bff9d-24e4-43bc-9d9f-a8973cb893f4" HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533" ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429" TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" diff --git a/src/rest.jl b/src/rest.jl index ef03c71..fc21327 100644 --- a/src/rest.jl +++ b/src/rest.jl @@ -18,6 +18,7 @@ using Dates: now, datetime2unix import HTTP import JSON3 +import Logging """ Context @@ -188,7 +189,9 @@ function request( _authenticate!(ctx, headers) opts = (;redirect = false, pool = POOL, verbose=3) @info "HTTP.request" method url opts kw - r = HTTP.request(method, url, headers; query = query, body = body, opts..., kw...) + r = Base.with_logger(Logging.ConsoleLogger(stderr, Logging.Debug)) do + HTTP.request(method, url, headers; query = query, body = body, opts..., kw...) + end @info "HTTP.response" method url r.status return r end