Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't uses log-with-verbosity macros with current_exceptions_to_string #1144

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Servers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ function listenloop(f, listener, conns, tcpisvalid,
verbose >= 0 && @infov 1 "Server on $(listener.hostname):$(listener.hostport) closing"
else
msg = current_exceptions_to_string()
@errorv 2 "Server on $(listener.hostname):$(listener.hostport) errored. $msg"
@error "Server on $(listener.hostname):$(listener.hostport) errored. $msg"
# quick little sleep in case there's a temporary
# local error accepting and this might help avoid quickly re-erroring
sleep(0.05 + rand() * 0.05)
Expand Down Expand Up @@ -434,7 +434,7 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
write(c, Response(e.code == :HEADER_SIZE_EXCEEDS_LIMIT ? 431 : 400, string(e.code)))
end
msg = current_exceptions_to_string()
@debugv 1 "handle_connection startread error. $msg"
@warn "handle_connection startread error. $msg"
break
end

Expand Down Expand Up @@ -462,7 +462,7 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
# anyone can do about it on this side. No reason to log an error in that case.
level = e isa Base.IOError && !isopen(c) ? Logging.Debug : Logging.Error
msg = current_exceptions_to_string()
@logmsgv 1 level "handle_connection handler error. $msg"
@warn "handle_connection handler error. $msg"

if isopen(http) && !iswritable(http)
request.response.status = 500
Expand All @@ -480,7 +480,7 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
catch
# we should be catching everything inside the while loop, but just in case
msg = current_exceptions_to_string()
@errorv 1 "error while handling connection. $msg"
@error "error while handling connection. $msg"
finally
if readtimeout > 0
wait_for_timeout[] = false
Expand Down
6 changes: 4 additions & 2 deletions src/WebSockets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,10 @@ function upgrade(f::Function, http::Streams.Stream; suppress_close_error::Bool=f
f(ws)
catch e
if !isok(e)
msg = current_exceptions_to_string()
suppress_close_error || @error "$(ws.id): Unexpected websocket server error. $msg"
if !suppress_close_error
msg = current_exceptions_to_string()
@error "$(ws.id): Unexpected websocket server error. $msg"
end
end
if !isclosed(ws)
if e isa WebSocketError && e.message isa CloseFrameBody
Expand Down