From 8e0aabc730a81671f8e46cb5c7d7cc7d214a6e9c Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 10 Dec 2012 13:35:31 -0500 Subject: [PATCH] zephyr_mirror: Improve debugging output on outgoing messages. Previously all that we logged was the sender, which turns out to be a constant for humbug=>zephyr mirroring. (imported from commit 527a3ac4b9b815a2b4d6b63c3ad92d9d5ad99a6e) --- bots/zephyr_mirror_backend.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index a478611..3165c36 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -440,7 +440,6 @@ def forward_to_zephyr(message): zwrite_args = ["zwrite", "-n", "-s", zsig_fullname, "-F", "Class $class, Instance $instance:\n" + "To: @bold($recipient) at $time $date\n" + "From: @bold{$1 <$sender>}\n\n$2@(@color(blue))"] - logger.info("Forwarding message from %s" % (message["sender_email"],)) if message['type'] == "stream": zephyr_class = message["display_recipient"] instance = message["subject"] @@ -461,21 +460,24 @@ def forward_to_zephyr(message): instance = zephyr_class zephyr_class = "message" zwrite_args.extend(["-c", zephyr_class, "-i", instance]) + logger.info("Forwarding message to class %s, instance %s" % (zephyr_class, instance)) elif message['type'] == "private": if len(message['display_recipient']) == 1: recipient = to_zephyr_username(message["display_recipient"][0]["email"]) - zwrite_args.extend([recipient]) + recipients = [recipient] elif len(message['display_recipient']) == 2: recipient = "" for r in message["display_recipient"]: if r["email"].lower() != humbug_account_email.lower(): recipient = to_zephyr_username(r["email"]) break - zwrite_args.extend([recipient]) + recipients = [recipient] else: zwrite_args.extend(["-C"]) - zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "") - for user in message["display_recipient"]]) + recipients = [to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "") + for user in message["display_recipient"]] + logger.info("Forwarding message to %s" % (recipients,)) + zwrite_args.extend(recipients) if options.test_mode: logger.debug("Would have forwarded: %s\n%s" %