fix logging in JSON format
This commit is contained in:
parent
9b401994a1
commit
09f6fd6355
|
@ -93,7 +93,7 @@ proc processClient(server: StreamServer,
|
||||||
var header: HttpRequestHeader
|
var header: HttpRequestHeader
|
||||||
var connection: string
|
var connection: string
|
||||||
|
|
||||||
info "Received connection", address = transp.remoteAddress()
|
info "Received connection", address = $transp.remoteAddress()
|
||||||
while true:
|
while true:
|
||||||
try:
|
try:
|
||||||
let hlenfut = transp.readUntil(addr buffer[0], MaxHttpHeadersSize,
|
let hlenfut = transp.readUntil(addr buffer[0], MaxHttpHeadersSize,
|
||||||
|
@ -143,7 +143,7 @@ proc processClient(server: StreamServer,
|
||||||
let vres = await validateRequest(transp, header)
|
let vres = await validateRequest(transp, header)
|
||||||
|
|
||||||
if vres == Success:
|
if vres == Success:
|
||||||
info "Received valid RPC request", address = transp.remoteAddress()
|
info "Received valid RPC request", address = $transp.remoteAddress()
|
||||||
|
|
||||||
# we need to get `Connection` header value before, because
|
# we need to get `Connection` header value before, because
|
||||||
# we are reusing `buffer`, and its value will be lost.
|
# we are reusing `buffer`, and its value will be lost.
|
||||||
|
@ -187,7 +187,7 @@ proc processClient(server: StreamServer,
|
||||||
else:
|
else:
|
||||||
var data = future.read()
|
var data = future.read()
|
||||||
let res = await transp.sendAnswer(header.version, Http200, data)
|
let res = await transp.sendAnswer(header.version, Http200, data)
|
||||||
info "RPC result has been sent", address = transp.remoteAddress()
|
info "RPC result has been sent", address = $transp.remoteAddress()
|
||||||
if not res:
|
if not res:
|
||||||
await transp.closeWait()
|
await transp.closeWait()
|
||||||
break
|
break
|
||||||
|
@ -206,7 +206,7 @@ proc processClient(server: StreamServer,
|
||||||
await transp.closeWait()
|
await transp.closeWait()
|
||||||
break
|
break
|
||||||
|
|
||||||
info "Finished connection", address = transp.remoteAddress()
|
info "Finished connection", address = $transp.remoteAddress()
|
||||||
|
|
||||||
# Utility functions for setting up servers using stream transport addresses
|
# Utility functions for setting up servers using stream transport addresses
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue