From 7e668c4c85065f012d4da50487586eb4ceca8ff6 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 25 Jun 2021 12:46:57 +0700 Subject: [PATCH] fix compile time error when using chronicles sink:json fixes #73 --- ws.nimble | 3 +++ ws/http/server.nim | 4 ++-- ws/session.nim | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ws.nimble b/ws.nimble index a994508..5e522c4 100644 --- a/ws.nimble +++ b/ws.nimble @@ -25,6 +25,9 @@ requires "bearssl" requires "https://github.com/status-im/nim-zlib" task test, "run tests": + # dont't need to run it, only want to test if it is compileable + exec "nim c -c --verbosity:0 --hints:off -d:chronicles_log_level=TRACE -d:chronicles_sinks:json ./tests/testcommon" + exec "nim --hints:off c -r --opt:speed -d:debug --verbosity:0 --hints:off -d:chronicles_log_level=info ./tests/testcommon.nim" rmFile "./tests/testcommon" diff --git a/ws/http/server.nim b/ws/http/server.nim index ea2fb32..b6d7a55 100644 --- a/ws/http/server.nim +++ b/ws/http/server.nim @@ -38,13 +38,13 @@ proc validateRequest( ## if header.meth notin {MethodGet}: - trace "GET method is only allowed", address = stream.tsource.remoteAddress() + trace "GET method is only allowed", address = $stream.tsource.remoteAddress() await stream.sendError(Http405, version = header.version) return ReqStatus.Error var hlen = header.contentLength() if hlen < 0 or hlen > MaxHttpRequestSize: - trace "Invalid header length", address = stream.tsource.remoteAddress() + trace "Invalid header length", address = $stream.tsource.remoteAddress() await stream.sendError(Http413, version = header.version) return ReqStatus.Error diff --git a/ws/session.nim b/ws/session.nim index 896e651..0978ad7 100644 --- a/ws/session.nim +++ b/ws/session.nim @@ -184,7 +184,7 @@ proc handleClose*( raise newException(WSInvalidUTF8, "Invalid UTF8 sequence detected in close reason") - trace "Handling close message", code, reason + trace "Handling close message", code = $code, reason if not isNil(ws.onClose): try: (code, reason) = ws.onClose(code, reason) @@ -197,7 +197,7 @@ proc handleClose*( # don't respond to a terminated connection if ws.readyState != ReadyState.Closing: ws.readyState = ReadyState.Closing - trace "Sending close", code, reason + trace "Sending close", code = $code, reason await ws.send(prepareCloseBody(code, reason), Opcode.Close) ws.readyState = ReadyState.Closed