Skip to content

Commit c031311

Browse files
authored
Remove usage of deprecated verbosity macros (#1190)
1 parent 4ebb277 commit c031311

16 files changed

+71
-71
lines changed

src/Connections.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Connections
2121

2222
export Connection, newconnection, releaseconnection, getrawstream, inactiveseconds, shouldtimeout, default_connection_limit, set_default_connection_limit!, Pool
2323

24-
using Sockets, LoggingExtras, NetworkOptions
24+
using Sockets, NetworkOptions
2525
using MbedTLS: SSLConfig, SSLContext, setup!, associate!, hostname!, handshake!
2626
using MbedTLS, OpenSSL, ConcurrentUtilities
2727
using ..IOExtras, ..Conditions, ..Exceptions
@@ -254,7 +254,7 @@ end
254254
function IOExtras.startwrite(c::Connection)
255255
@require !iswritable(c)
256256
c.writable = true
257-
@debugv 3 "👁 Start write:$c"
257+
@debug "👁 Start write:$c"
258258
return
259259
end
260260

@@ -266,7 +266,7 @@ Signal that an entire Request Message has been written to the `Connection`.
266266
function IOExtras.closewrite(c::Connection)
267267
@require iswritable(c)
268268
c.writable = false
269-
@debugv 3 "🗣 Write done: $c"
269+
@debug "🗣 Write done: $c"
270270
flush(c)
271271
return
272272
end
@@ -278,7 +278,7 @@ function IOExtras.startread(c::Connection)
278278
@require !isreadable(c)
279279
c.timestamp = time()
280280
c.readable = true
281-
@debugv 3 "👁 Start read: $c"
281+
@debug "👁 Start read: $c"
282282
return
283283
end
284284

@@ -289,7 +289,7 @@ TODO: or if response data arrives when no request was sent (isreadable == false)
289289
"""
290290
function monitor_idle_connection(c::Connection)
291291
try
292-
if eof(c.io) ;@debugv 3 "💀 Closed: $c"
292+
if eof(c.io) ;@debug "💀 Closed: $c"
293293
close(c.io)
294294
end
295295
catch ex
@@ -307,7 +307,7 @@ Signal that an entire Response Message has been read from the `Connection`.
307307
function IOExtras.closeread(c::Connection)
308308
@require isreadable(c)
309309
c.readable = false
310-
@debugv 3 "✉️ Read done: $c"
310+
@debug "✉️ Read done: $c"
311311
if c.clientconnection
312312
t = Threads.@spawn monitor_idle_connection(c)
313313
@isdefined(errormonitor) && errormonitor(t)
@@ -516,7 +516,7 @@ function getconnection(::Type{TCPSocket},
516516
kw...)::TCPSocket
517517

518518
p::UInt = isempty(port) ? UInt(80) : parse(UInt, port)
519-
@debugv 2 "TCP connect: $host:$p..."
519+
@debug "TCP connect: $host:$p..."
520520
addrs = Sockets.getalladdrinfo(host)
521521
err = ErrorException("failed to connect")
522522
for addr in addrs
@@ -570,7 +570,7 @@ function getconnection(::Type{SSLContext},
570570
kw...)::SSLContext
571571

572572
port = isempty(port) ? "443" : port
573-
@debugv 2 "SSL connect: $host:$port..."
573+
@debug "SSL connect: $host:$port..."
574574
tcp = getconnection(TCPSocket, host, port; kw...)
575575
return sslconnection(SSLContext, tcp, host; kw...)
576576
end
@@ -581,7 +581,7 @@ function getconnection(::Type{SSLStream},
581581
kw...)::SSLStream
582582

583583
port = isempty(port) ? "443" : port
584-
@debugv 2 "SSL connect: $host:$port..."
584+
@debug "SSL connect: $host:$port..."
585585
tcp = getconnection(TCPSocket, host, port; kw...)
586586
return sslconnection(SSLStream, tcp, host; kw...)
587587
end

src/Exceptions.jl

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

33
export @try, HTTPError, ConnectError, TimeoutError, StatusError, RequestError, current_exceptions_to_string
4-
using LoggingExtras, ExceptionUnwrapping
4+
using ExceptionUnwrapping
55
import ..HTTP # for doc references
66

77
@eval begin

src/HTTP.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const DEBUG_LEVEL = Ref(0)
77

88
Base.@deprecate escape escapeuri
99

10-
using Base64, Sockets, Dates, URIs, LoggingExtras, MbedTLS, OpenSSL
10+
using Base64, Sockets, Dates, URIs, MbedTLS, OpenSSL
1111

1212
function access_threaded(f, v::Vector)
1313
tid = Threads.threadid()

src/Servers.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
443443
# attempt to read request line and headers
444444
try
445445
startread(http)
446-
@debugv 1 "startread called"
446+
@debug "startread called"
447447
c.state = ACTIVE # once we've started reading, set ACTIVE state
448448
catch e
449449
# for ParserErrors, try to inform client of the problem
450450
if e isa ParseError
451451
write(c, Response(e.code == :HEADER_SIZE_EXCEEDS_LIMIT ? 431 : 400, string(e.code)))
452452
end
453-
@debugv 1 begin
453+
@debug begin
454454
msg = current_exceptions_to_string()
455455
"handle_connection startread error. $msg"
456456
end
@@ -465,15 +465,15 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
465465

466466
try
467467
# invokelatest becuase the perf is negligible, but this makes live-editing handlers more Revise friendly
468-
@debugv 1 "invoking handler"
468+
@debug "invoking handler"
469469
Base.invokelatest(f, http)
470470
# If `startwrite()` was never called, throw an error so we send a 500 and log this
471471
if isopen(http) && !iswritable(http)
472472
error("Server never wrote a response.\n\n$request")
473473
end
474-
@debugv 1 "closeread"
474+
@debug "closeread"
475475
closeread(http)
476-
@debugv 1 "closewrite"
476+
@debug "closewrite"
477477
closewrite(http)
478478
c.state = IDLE
479479
catch e

src/Streams.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Streams
22

33
export Stream, closebody, isaborted, setstatus, readall!
44

5-
using Sockets, LoggingExtras
5+
using Sockets
66
using ..IOExtras, ..Messages, ..Connections, ..Conditions, ..Exceptions
77
import ..HTTP # for doc references
88

@@ -132,7 +132,7 @@ function IOExtras.closewrite(http::Stream{<:Request})
132132
http.message.version < v"1.1" &&
133133
!hasheader(http.message, "Connection", "keep-alive")
134134

135-
@debugv 1 "\"Connection: close\": $(http.stream)"
135+
@debug "\"Connection: close\": $(http.stream)"
136136
close(http.stream)
137137
end
138138
end
@@ -166,7 +166,7 @@ https://tools.ietf.org/html/rfc7231#section-6.2.1
166166
"""
167167
function handle_continue(http::Stream{<:Response})
168168
if http.message.status == 100
169-
@debugv 1 "✅ Continue: $(http.stream)"
169+
@debug "✅ Continue: $(http.stream)"
170170
readheaders(http.stream, http.message)
171171
end
172172
end
@@ -176,7 +176,7 @@ function handle_continue(http::Stream{<:Request})
176176
if !iswritable(http.stream)
177177
startwrite(http.stream)
178178
end
179-
@debugv 1 "✅ Continue: $(http.stream)"
179+
@debug "✅ Continue: $(http.stream)"
180180
writeheaders(http.stream, Response(100))
181181
end
182182
end
@@ -361,9 +361,9 @@ function isaborted(http::Stream{<:Response})
361361
if iswritable(http.stream) &&
362362
iserror(http.message) &&
363363
hasheader(http.message, "Connection", "close")
364-
@debugv 1 "✋ Abort on $(sprint(writestartline, http.message)): " *
364+
@debug "✋ Abort on $(sprint(writestartline, http.message)): " *
365365
"$(http.stream)"
366-
@debugv 2 "$(http.message)"
366+
@debug "$(http.message)"
367367
return true
368368
end
369369
return false
@@ -379,7 +379,7 @@ function IOExtras.closeread(http::Stream{<:Response})
379379

380380
if hasheader(http.message, "Connection", "close")
381381
# Close conncetion if server sent "Connection: close"...
382-
@debugv 1 "\"Connection: close\": $(http.stream)"
382+
@debug "\"Connection: close\": $(http.stream)"
383383
close(http.stream)
384384
# Error if Message is not complete...
385385
incomplete(http) && throw(EOFError())

src/WebSockets.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module WebSockets
22

3-
using Base64, LoggingExtras, UUIDs, Sockets, Random
3+
using Base64, UUIDs, Sockets, Random
44
using MbedTLS: digest, MD_SHA1, SSLContext
55
using ..IOExtras, ..Streams, ..Connections, ..Messages, ..Conditions, ..Servers
66
using ..Exceptions: current_exceptions_to_string
@@ -373,7 +373,7 @@ function open(f::Function, url; suppress_close_error::Bool=false, verbose=false,
373373
http.ntoread = 0
374374
io = http.stream
375375
ws = WebSocket(io, http.message.request, http.message; maxframesize, maxfragmentation)
376-
@debugv 2 "$(ws.id): WebSocket opened"
376+
@debug "$(ws.id): WebSocket opened"
377377
try
378378
f(ws)
379379
catch e
@@ -423,7 +423,7 @@ listen(f, args...; kw...) = Servers.listen(http -> upgrade(f, http; kw...), args
423423
listen!(f, args...; kw...) = Servers.listen!(http -> upgrade(f, http; kw...), args...; kw...)
424424

425425
function upgrade(f::Function, http::Streams.Stream; suppress_close_error::Bool=false, maxframesize::Integer=typemax(Int), maxfragmentation::Integer=DEFAULT_MAX_FRAG, nagle=false, quickack=true, kw...)
426-
@debugv 2 "Server websocket upgrade requested"
426+
@debug "Server websocket upgrade requested"
427427
isupgrade(http.message) || handshakeerror()
428428
if !hasheader(http, "Sec-WebSocket-Version", "13")
429429
throw(WebSocketError("Expected \"Sec-WebSocket-Version: 13\"!\n" * "$(http.message)"))
@@ -451,7 +451,7 @@ function upgrade(f::Function, http::Streams.Stream; suppress_close_error::Bool=f
451451
end
452452

453453
ws = WebSocket(io, req, req.response; client=false, maxframesize, maxfragmentation)
454-
@debugv 2 "$(ws.id): WebSocket upgraded; connection established"
454+
@debug "$(ws.id): WebSocket upgraded; connection established"
455455
try
456456
f(ws)
457457
catch e
@@ -511,7 +511,7 @@ or `close(ws[, body::WebSockets.CloseFrameBody])`. Calling `close` will initiate
511511
the close sequence and close the underlying connection.
512512
"""
513513
function Sockets.send(ws::WebSocket, x)
514-
@debugv 2 "$(ws.id): Writing non-control message"
514+
@debug "$(ws.id): Writing non-control message"
515515
@require !ws.writeclosed
516516
if !isbinary(x) && !istext(x)
517517
# if x is not single binary or text, then assume it's an iterable of binary or text
@@ -524,7 +524,7 @@ function Sockets.send(ws::WebSocket, x)
524524
x = ""
525525
@goto write_single_frame
526526
end
527-
@debugv 2 "$(ws.id): Writing fragmented message"
527+
@debug "$(ws.id): Writing fragmented message"
528528
item, st = state
529529
# we prefetch next state so we know if we're on the last item or not
530530
# so we can appropriately set the FIN bit for the last fragmented frame
@@ -553,7 +553,7 @@ to when a PING message is received by a websocket connection.
553553
"""
554554
function ping(ws::WebSocket, data=UInt8[])
555555
@require !ws.writeclosed
556-
@debugv 2 "$(ws.id): sending ping"
556+
@debug "$(ws.id): sending ping"
557557
return writeframe(ws.io, Frame(true, PING, ws.client, payload(ws, data)))
558558
end
559559

@@ -568,7 +568,7 @@ used as a one-way heartbeat.
568568
"""
569569
function pong(ws::WebSocket, data=UInt8[])
570570
@require !ws.writeclosed
571-
@debugv 2 "$(ws.id): sending pong"
571+
@debug "$(ws.id): sending pong"
572572
return writeframe(ws.io, Frame(true, PONG, ws.client, payload(ws, data)))
573573
end
574574

@@ -584,7 +584,7 @@ frame.
584584
"""
585585
function Base.close(ws::WebSocket, body::CloseFrameBody=CloseFrameBody(1000, ""))
586586
isclosed(ws) && return
587-
@debugv 2 "$(ws.id): Closing websocket"
587+
@debug "$(ws.id): Closing websocket"
588588
ws.writeclosed = true
589589
data = Vector{UInt8}(body.message)
590590
prepend!(data, reinterpret(UInt8, [hton(UInt16(body.status))]))
@@ -676,10 +676,10 @@ returned by `receive`. Note that `WebSocket` objects can be iterated,
676676
where each iteration yields a message until the connection is closed.
677677
"""
678678
function receive(ws::WebSocket)
679-
@debugv 2 "$(ws.id): Reading message"
679+
@debug "$(ws.id): Reading message"
680680
@require !ws.readclosed
681681
frame = readframe(ws.io, Frame, ws.readbuffer)
682-
@debugv 2 "$(ws.id): Received frame: $frame"
682+
@debug "$(ws.id): Received frame: $frame"
683683
done = checkreadframe!(ws, frame)
684684
# common case of reading single non-control frame
685685
done && return frame.payload
@@ -689,16 +689,16 @@ function receive(ws::WebSocket)
689689
payload = frame.payload
690690
while true
691691
frame = readframe(ws.io, Frame, ws.readbuffer, opcode)
692-
@debugv 2 "$(ws.id): Received frame: $frame"
692+
@debug "$(ws.id): Received frame: $frame"
693693
done = checkreadframe!(ws, frame)
694694
if !iscontrol(frame.flags.opcode)
695695
payload = _append(payload, frame.payload)
696-
@debugv 2 "$(ws.id): payload len = $(length(payload))"
696+
@debug "$(ws.id): payload len = $(length(payload))"
697697
end
698698
done && break
699699
end
700700
payload isa String && utf8check(payload)
701-
@debugv 2 "Read message: $(payload[1:min(1024, sizeof(payload))])"
701+
@debug "Read message: $(payload[1:min(1024, sizeof(payload))])"
702702
return payload
703703
end
704704

src/clientlayers/ConnectionRequest.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ConnectionRequest
22

3-
using URIs, Sockets, Base64, LoggingExtras, ConcurrentUtilities, ExceptionUnwrapping
3+
using URIs, Sockets, Base64, ConcurrentUtilities, ExceptionUnwrapping
44
import MbedTLS
55
import OpenSSL
66
using ..Messages, ..IOExtras, ..Connections, ..Streams, ..Exceptions
@@ -68,7 +68,7 @@ function connectionlayer(handler)
6868

6969
userinfo = unescapeuri(url.userinfo)
7070
if !isempty(userinfo) && !hasheader(req.headers, "Proxy-Authorization")
71-
@debugv 1 "Adding Proxy-Authorization: Basic header."
71+
@debug "Adding Proxy-Authorization: Basic header."
7272
setheader(req.headers, "Proxy-Authorization" => "Basic $(base64encode(userinfo))")
7373
end
7474
else
@@ -134,7 +134,7 @@ function connectionlayer(handler)
134134
if logerrors && !ExceptionUnwrapping.has_wrapped_exception(e, HTTPError)
135135
@error current_exceptions_to_string() type=Symbol("HTTP.ConnectionRequest") method=req.method url=req.url context=req.context logtag=logtag
136136
end
137-
@debugv 1 "❗️ ConnectionLayer $root_err. Closing: $io"
137+
@debug "❗️ ConnectionLayer $root_err. Closing: $io"
138138
if @isdefined(stream) && stream.nwritten == -1
139139
# we didn't write anything, so don't need to worry about
140140
# idempotency of the request
@@ -210,17 +210,17 @@ end
210210

211211
function connect_tunnel(io, target_url, req)
212212
target = "$(URIs.hoststring(target_url.host)):$(target_url.port)"
213-
@debugv 1 "📡 CONNECT HTTPS tunnel to $target"
213+
@debug "📡 CONNECT HTTPS tunnel to $target"
214214
headers = Dict("Host" => target)
215215
if (auth = header(req, "Proxy-Authorization"); !isempty(auth))
216216
headers["Proxy-Authorization"] = auth
217217
end
218218
request = Request("CONNECT", target, headers)
219-
# @debugv 2 "connect_tunnel: writing headers"
219+
# @debug "connect_tunnel: writing headers"
220220
writeheaders(io, request)
221-
# @debugv 2 "connect_tunnel: reading headers"
221+
# @debug "connect_tunnel: reading headers"
222222
readheaders(io, request.response)
223-
# @debugv 2 "connect_tunnel: done reading headers"
223+
# @debug "connect_tunnel: done reading headers"
224224
return request.response
225225
end
226226

src/clientlayers/CookieRequest.jl

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

3-
using Dates, LoggingExtras, URIs
3+
using Dates, URIs
44
using ..Cookies, ..Messages, ..Strings
55

66
# default global cookie jar

src/clientlayers/HeadersRequest.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module HeadersRequest
22

33
export headerslayer, setuseragent!
44

5-
using Base64, URIs, LoggingExtras
5+
using Base64, URIs
66
using ..Messages, ..Forms, ..IOExtras, ..Sniff, ..Forms, ..Strings
77

88
"""
@@ -18,7 +18,7 @@ function headerslayer(handler)
1818
if basicauth
1919
userinfo = unescapeuri(req.url.userinfo)
2020
if !isempty(userinfo) && !hasheader(headers, "Authorization")
21-
@debugv 1 "Adding Authorization: Basic header."
21+
@debug "Adding Authorization: Basic header."
2222
setheader(headers, "Authorization" => "Basic $(base64encode(userinfo))")
2323
end
2424
end
@@ -29,7 +29,7 @@ function headerslayer(handler)
2929

3030
sn = sniff(bytes(req.body))
3131
setheader(headers, "Content-Type" => sn)
32-
@debugv 1 "setting Content-Type header to: $sn"
32+
@debug "setting Content-Type header to: $sn"
3333
end
3434
## default headers
3535
if isempty(req.url.port) ||

0 commit comments

Comments
 (0)