print url in log startup message (#89)

...and tone down connection logging
This commit is contained in:
Jacek Sieka 2021-01-07 10:42:26 +01:00 committed by GitHub
parent dc3a2d33fc
commit ce51ffdf16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import json, strutils
import std/[json, strutils]
import chronicles, httputils, chronos
import ../server
@ -93,7 +93,7 @@ proc processClient(server: StreamServer,
var header: HttpRequestHeader
var connection: string
info "Received connection", address = $transp.remoteAddress()
debug "Received connection", address = $transp.remoteAddress()
while true:
try:
let hlenfut = transp.readUntil(addr buffer[0], MaxHttpHeadersSize,
@ -206,13 +206,13 @@ proc processClient(server: StreamServer,
await transp.closeWait()
break
info "Finished connection", address = $transp.remoteAddress()
debug "Finished connection", address = $transp.remoteAddress()
# Utility functions for setting up servers using stream transport addresses
proc addStreamServer*(server: RpcHttpServer, address: TransportAddress) =
try:
info "Creating server on ", address = $address
info "Starting JSON-RPC HTTP server", url = "http://" & $address
var transServer = createStreamServer(address, processClient,
{ReuseAddr}, udata = server)
server.servers.add(transServer)

View File

@ -1,5 +1,7 @@
import
json, json_serialization/std/net,
std/json,
chronicles,
json_serialization/std/net,
../server
export server
@ -33,7 +35,7 @@ proc processClient(server: StreamServer, transport: StreamTransport) {.async, gc
proc addStreamServer*(server: RpcSocketServer, address: TransportAddress) =
try:
info "Creating server on ", address = $address
info "Starting JSON-RPC socket server", address = $address
var transportServer = createStreamServer(address, processClient, {ReuseAddr}, udata = server)
server.servers.add(transportServer)
except CatchableError as exc: