Skip to content

Commit 66a2dbf

Browse files
authored
Fix remaining server verbosity logs (#1193)
1 parent 1e92b1a commit 66a2dbf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Servers.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,17 @@ function listenloop(
379379
conns_lock, verbose
380380
)
381381
sem = Base.Semaphore(max_connections)
382-
verbose >= 0 && @infov 1 "Listening on: $(listener.hostname):$(listener.hostport), thread id: $(Threads.threadid())"
382+
verbose >= 0 && @info "Listening on: $(listener.hostname):$(listener.hostport), thread id: $(Threads.threadid())"
383383
notify(ready_to_accept)
384384
while isopen(listener)
385385
try
386386
Base.acquire(sem)
387387
io = accept(listener)
388388
if io === nothing
389-
@warnv 1 "unable to accept new connection"
389+
verbose >= 0 && @warn "unable to accept new connection"
390390
continue
391391
elseif !tcpisvalid(io)
392-
@warnv 1 "!tcpisvalid: $io"
392+
verbose >= 0 && @warn "!tcpisvalid: $io"
393393
close(io)
394394
continue
395395
end
@@ -398,17 +398,17 @@ function listenloop(
398398
Base.@lock conns_lock push!(conns, conn)
399399
conn.host, conn.port = listener.hostname, listener.hostport
400400
@async try
401-
handle_connection(f, conn, listener, readtimeout, access_log)
401+
handle_connection(f, conn, listener, readtimeout, access_log, verbose)
402402
finally
403403
# handle_connection is in charge of closing the underlying io
404404
Base.@lock conns_lock delete!(conns, conn)
405405
Base.release(sem)
406406
end
407407
catch e
408408
if e isa Base.IOError && e.code == Base.UV_ECONNABORTED
409-
verbose >= 0 && @infov 1 "Server on $(listener.hostname):$(listener.hostport) closing"
409+
verbose >= 0 && @info "Server on $(listener.hostname):$(listener.hostport) closing"
410410
else
411-
@errorv 2 begin
411+
verbose >= 1 && @error begin
412412
msg = current_exceptions_to_string()
413413
"Server on $(listener.hostname):$(listener.hostport) errored. $msg"
414414
end
@@ -428,10 +428,10 @@ for each HTTP Request received.
428428
After `reuse_limit + 1` transactions, signal `final_transaction` to the
429429
transaction handler, which will close the connection.
430430
"""
431-
function handle_connection(f, c::Connection, listener, readtimeout, access_log)
431+
function handle_connection(f, c::Connection, listener, readtimeout, access_log, verbose)
432432
wait_for_timeout = Ref{Bool}(true)
433433
if readtimeout > 0
434-
@async check_readtimeout(c, readtimeout, wait_for_timeout)
434+
@async check_readtimeout(c, readtimeout, wait_for_timeout, verbose)
435435
end
436436
try
437437
# if the connection socket or listener close, we stop taking requests
@@ -499,7 +499,7 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
499499
end
500500
catch
501501
# we should be catching everything inside the while loop, but just in case
502-
@errorv 1 begin
502+
verbose >= 0 && @error begin
503503
msg = current_exceptions_to_string()
504504
"error while handling connection. $msg"
505505
end
@@ -516,10 +516,10 @@ end
516516
"""
517517
If `c` is inactive for a more than `readtimeout` then close the `c`."
518518
"""
519-
function check_readtimeout(c, readtimeout, wait_for_timeout)
519+
function check_readtimeout(c, readtimeout, wait_for_timeout, verbose)
520520
while wait_for_timeout[]
521521
if inactiveseconds(c) > readtimeout
522-
@warnv 2 "Connection Timeout: $c"
522+
verbose >= 0 && @warn "Connection Timeout: $c"
523523
try
524524
writeheaders(c, Response(408, ["Connection" => "close"]))
525525
finally

0 commit comments

Comments
 (0)