Skip to content

Commit

Permalink
Hijack global logger
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Sep 6, 2023
1 parent 36e4599 commit 3b40015
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion src/rest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Dates: now, datetime2unix
import HTTP
import JSON3
import Logging

"""
Context
Expand Down Expand Up @@ -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

0 comments on commit 3b40015

Please sign in to comment.