diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-10-15 18:53:16 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | 21979c3e6125170fc5ff024d20dfb12e7a25100e (patch) | |
tree | 078461b567da96016eb2cd72639d151be87e2078 /slack/slack_workspace.py | |
parent | e54d7d3048fae8c4a7ecbfeedf50c11da50a93f2 (diff) | |
download | wee-slack-21979c3e6125170fc5ff024d20dfb12e7a25100e.tar.gz |
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.
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r-- | slack/slack_workspace.py | 19 |
1 files changed, 14 insertions, 5 deletions
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)) |