outposts: fix channel not always having a logger attribute

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-02-03 17:58:54 +01:00
parent 654e0d6245
commit 39ff202f8c

View file

@ -55,6 +55,10 @@ class OutpostConsumer(AuthJsonConsumer):
first_msg = False first_msg = False
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.logger = get_logger()
def connect(self): def connect(self):
super().connect() super().connect()
uuid = self.scope["url_route"]["kwargs"]["pk"] uuid = self.scope["url_route"]["kwargs"]["pk"]
@ -65,7 +69,7 @@ class OutpostConsumer(AuthJsonConsumer):
) )
if not outpost: if not outpost:
raise DenyConnection() raise DenyConnection()
self.logger = get_logger().bind(outpost=outpost) self.logger = self.logger.bind(outpost=outpost)
try: try:
self.accept() self.accept()
except RuntimeError as exc: except RuntimeError as exc: