From 7fa76cd4effd49376f57c7a9abe47e601c710deb Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 23 Feb 2025 18:36:35 +0000 Subject: [PATCH] Remove some debug statements --- core/management/commands/component.py | 16 +++------------- core/management/commands/processing.py | 7 ------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/core/management/commands/component.py b/core/management/commands/component.py index 4385ee8..76bef07 100644 --- a/core/management/commands/component.py +++ b/core/management/commands/component.py @@ -296,7 +296,7 @@ class EchoComponent(ComponentXMPP): self.connect() def session_start(self, *args): - log.info(f"START {args}") + log.info(f"Session started: {args}") async def request_upload_slot(self, recipient, filename, content_type, size): """ @@ -332,8 +332,6 @@ class EchoComponent(ComponentXMPP): log.error(f"Failed to obtain upload slot for {filename}") return None - log.info(f"Slot: {slot}") - # Parse the XML response root = ET.fromstring(str(slot)) # Convert to string if necessary namespace = "{urn:xmpp:http:upload:0}" # Define the namespace @@ -342,8 +340,6 @@ class EchoComponent(ComponentXMPP): put_element = root.find(f".//{namespace}put") put_url = put_element.attrib.get("url") - log.info(f"Put element: {ET.tostring(put_element, encoding='unicode')}") # Debugging - # Extract the Authorization header correctly header_element = put_element.find(f"./{namespace}header[@name='Authorization']") auth_header = header_element.text.strip() if header_element is not None else None @@ -352,8 +348,6 @@ class EchoComponent(ComponentXMPP): log.error(f"Missing URLs in upload slot: {slot}") return None - log.info(f"Got upload slot: {get_url}, Authorization: {auth_header}") - return get_url, put_url, auth_header except Exception as e: @@ -499,11 +493,10 @@ class EchoComponent(ComponentXMPP): text_msg["body"] = text log.info(f"Sending separate text message: {text}") if detail.is_outgoing_message: - log.info("OUT") + log.info("Outgoing message, not forwarding") ... else: log.info(f"Final XMPP message: {text_msg.xml}") - log.info(f"Sending message") text_msg.send() for att in attachments: @@ -541,11 +534,10 @@ class EchoComponent(ComponentXMPP): log.info(f"Sending file attachment message with URL: {upload_url}") if detail.is_outgoing_message: - log.info("OUT") + log.info("Outgoing message, not forwarding") ... else: log.info(f"Final XMPP message: {msg.xml}") - log.info(f"Sending message") msg.send() except Exception as e: @@ -559,12 +551,10 @@ async def stream(**kwargs): message = await pubsub.get_message(ignore_subscribe_messages=True) if message is not None: try: - log.info("GOT", message) data = message["data"] unpacked = msgpack.unpackb(data, raw=False) log.info(f"Unpacked: {unpacked}") except TypeError: - log.info(f"FAILED {message}") continue if "type" in unpacked.keys(): if unpacked["type"] == "def": diff --git a/core/management/commands/processing.py b/core/management/commands/processing.py index 85b1d93..a654e99 100644 --- a/core/management/commands/processing.py +++ b/core/management/commands/processing.py @@ -39,7 +39,6 @@ class HandleMessage(Command): "mentions": c.message.mentions, "raw_message": c.message.raw_message } - log.info("1") raw = json.loads(c.message.raw_message) print(json.dumps(c.message.raw_message, indent=2)) #dest = c.message.raw_message.get("envelope", {}).get("syncMessage", {}).get("sentMessage", {}).get("destinationUuid") @@ -47,10 +46,8 @@ class HandleMessage(Command): #account = c.message.raw_message.get("account", "") account = raw.get("account", "") - log.info("2") #source_name = msg["raw_message"].get("envelope", {}).get("sourceName", "") source_name = raw.get("envelope", {}).get("sourceName", "") - log.info("3") source_number = c.message.source_number source_uuid = c.message.source_uuid @@ -158,7 +155,6 @@ class HandleMessage(Command): text=result, ts=ts + 1, ) - # log.info("NOT SENDING CHECK CODE IS OK") # await natural.natural_send_message(c, result) tss = await natural.natural_send_message( result, @@ -236,12 +232,9 @@ async def stream(): message = await pubsub.get_message(ignore_subscribe_messages=True) if message is not None: try: - log.info("GOT", message) data = message["data"] unpacked = msgpack.unpackb(data, raw=False) - log.info(f"Unpacked: {unpacked}") except TypeError: - log.info(f"FAILED {message}") continue if "type" in unpacked.keys(): if unpacked["type"] == "def":