Logs notify messages on server
This commit is contained in:
parent
50bd31a9a6
commit
9ae66fb33b
@ -1,5 +1,6 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from ..utils import logging
|
||||
from ..utils.auth import async_has_perm
|
||||
from ..utils.constants import get_constants
|
||||
from ..utils.projector import get_projector_data
|
||||
@ -11,6 +12,9 @@ from ..utils.websocket import (
|
||||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class NotifyWebsocketClientMessage(BaseWebsocketClientMessage):
|
||||
"""
|
||||
Websocket message from a client to send a message to other clients.
|
||||
@ -64,6 +68,18 @@ class NotifyWebsocketClientMessage(BaseWebsocketClientMessage):
|
||||
in_response=id,
|
||||
)
|
||||
else:
|
||||
# Some logging
|
||||
name = content.get("name", "<unknown name>")
|
||||
users = content.get("users", [])
|
||||
if users is True:
|
||||
users = "all"
|
||||
else:
|
||||
users = ", ".join(users)
|
||||
reply_channels = ", ".join(content.get("replyChannels", []))
|
||||
logger.info(
|
||||
f"Got notify '{name}' from {consumer.channel_name} users={users} reply_channels={reply_channels}"
|
||||
)
|
||||
|
||||
# Forward to all other active site consumers to handle the notify message.
|
||||
await consumer.channel_layer.group_send(
|
||||
"site",
|
||||
|
Loading…
Reference in New Issue
Block a user