summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2021-03-03 19:12:41 +0000
committerJuan J. Martinez <jjm@usebox.net>2021-07-22 19:49:52 +0100
commita32d41edd27b984de947009b939b1e12315a0ea6 (patch)
tree9212630b274de7b6b85fda645e4c2635e70b8453 /server
parentd51046ce8e9148a43688625d4c18543750b33600 (diff)
downloadspacebeans-a32d41edd27b984de947009b939b1e12315a0ea6.tar.gz
spacebeans-a32d41edd27b984de947009b939b1e12315a0ea6.zip
Better logging of cases where the stream was terminated
Diffstat (limited to 'server')
-rw-r--r--server/src/net/usebox/gemini/server/Server.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/net/usebox/gemini/server/Server.scala b/server/src/net/usebox/gemini/server/Server.scala
index 76c64c4..a250158 100644
--- a/server/src/net/usebox/gemini/server/Server.scala
+++ b/server/src/net/usebox/gemini/server/Server.scala
@@ -227,13 +227,16 @@ case class Server(conf: ServiceConf) {
closing = TLSClosing.ignoreCancel
)
.runForeach { connection =>
- logger.debug(s"new connection ${connection.remoteAddress}")
+ val remoteHost = connection.remoteAddress.getHostString()
+ logger.debug(s"new connection $remoteHost")
val handler = Flow[ByteString]
.watchTermination() { (_, f) =>
f.onComplete {
_.toEither.swap.map(error =>
- logger.warn(s"stream terminated: ${error.getMessage()}")
+ logger.warn(
+ s"$remoteHost - stream terminated: ${error.getMessage()}"
+ )
)
}
}
@@ -263,8 +266,7 @@ case class Server(conf: ServiceConf) {
.take(1)
.wireTap(resp =>
logger.info(
- s"""${connection.remoteAddress
- .getHostString()} "${resp.req}" ${resp.status} ${resp.bodySize}"""
+ s"""$remoteHost "${resp.req}" ${resp.status} ${resp.bodySize}"""
)
)
.flatMapConcat(_.toSource)