Include the path info in the logging messages in WSRoute.

This commit is contained in:
Fabio Manganiello 2023-05-08 12:35:54 +02:00
parent 3fc622e296
commit 2d4b179879
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -32,7 +32,7 @@ class WSRoute(WebSocketHandler, Thread, ABC):
@override @override
def open(self, *_, **__): def open(self, *_, **__):
logger.info('Started websocket connection with %s', self.request.remote_ip) logger.info('Client %s connected to %s', self.request.remote_ip, self.path())
self.name = f'ws:{self.app_name()}@{self.request.remote_ip}' self.name = f'ws:{self.app_name()}@{self.request.remote_ip}'
self.start() self.start()
@ -97,8 +97,9 @@ class WSRoute(WebSocketHandler, Thread, ABC):
self._sub.close() self._sub.close()
logger.info( logger.info(
'Websocket connection to %s closed, reason=%s, message=%s', 'Client %s disconnected from %s, reason=%s, message=%s',
self.request.remote_ip, self.request.remote_ip,
self.path(),
self.close_code, self.close_code,
self.close_reason, self.close_reason,
) )