From 21979c3e6125170fc5ff024d20dfb12e7a25100e Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 15 Oct 2023 18:53:16 +0200 Subject: Log unknown websocket messages to debug buffer instead of core This just logs that a message is unknown/unhandled. The contents of the message will be printed on the line above. --- slack/slack_workspace.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'slack/slack_workspace.py') diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index f6574d9..61f86a7 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -346,14 +346,19 @@ class SlackWorkspace: elif "channel" in data and type(data["channel"]) == str: channel_id = data["channel"] else: - weechat.prnt("", f"\t{self.name} received: {json.dumps(data)}") + log( + LogLevel.DEBUG, + DebugMessageType.LOG, + f"unknown websocket message type (without channel): {data.get('type')}", + ) return channel = self.open_conversations.get(channel_id) if channel is None: - weechat.prnt( - "", - f"\t{self.name} received for not open conversation, discarding: {json.dumps(data)}", + log( + LogLevel.DEBUG, + DebugMessageType.LOG, + f"received websocket message for not open conversation, discarding", ) return @@ -408,7 +413,11 @@ class SlackWorkspace: elif data["type"] == "user_typing": await channel.typing_add_user(data) else: - weechat.prnt("", f"\t{self.name} received: {json.dumps(data)}") + log( + LogLevel.DEBUG, + DebugMessageType.LOG, + f"unknown websocket message type (with channel): {data.get('type')}", + ) except Exception as e: slack_error = SlackRtmError(self, e, data) print_error(store_and_format_exception(slack_error)) -- cgit