[Nym3-commit] r514 - trunk/nymbaron

zax at conuropsis.org zax at conuropsis.org
Wed May 24 12:16:09 CEST 2006


Author: zax
Date: 2006-05-24 12:16:09 +0200 (Wed, 24 May 2006)
New Revision: 514

Modified:
   trunk/nymbaron/Mail.py
Log:
Clean up some log messages.


Modified: trunk/nymbaron/Mail.py
===================================================================
--- trunk/nymbaron/Mail.py	2006-04-09 16:42:36 UTC (rev 513)
+++ trunk/nymbaron/Mail.py	2006-05-24 10:16:09 UTC (rev 514)
@@ -180,7 +180,7 @@
     mainMsg = email.Message.Message()
     mainMsg["To"] = you
     mainMsg["From"] = fromhdr
-    mail_logger.debug("Creating outgoing message from %s to %s" % (nym, you))
+    mail_logger.debug("Creating outgoing message from %s to %s", nym, you)
     if abuse:
         mainMsg['X-Abuse-Contact'] = abuse
     # Create a Date header using UTC
@@ -251,44 +251,44 @@
     mail_logger.debug("Sending outgoing message through smtplib")
     try:
         mailserver = smtplib.SMTP(smtphost)
-        mail_logger.debug("Connected to SMTP server %s" % smtphost)
+        mail_logger.debug("Connected to SMTP server %s", smtphost)
     except socket.error:
-        mail_logger.warn("Server %s does not appear to be listening for SMTP connections" % smtphost)
+        mail_logger.warn("Server %s does not appear to be listening for SMTP connections", smtphost)
         sys.exit(2)
     except socket.gaierror:
-        mail_logger.warn("Server %s is not responding" % smtphost)
+        mail_logger.warn("Server %s is not responding", smtphost)
         sys.exit(2)
     #mailserver.set_debuglevel(1)
     try:
         mailserver.sendmail(from_addr, [rcpt], payload)
-        mail_logger.debug("Message successfully relayed to SMTP server %s" % smtphost)
+        mail_logger.debug("Message successfully relayed to SMTP server %s", smtphost)
     except smtplib.SMTPRecipientsRefused:
-        mail_logger.info("All recipients were refused for message from %s" % nym)
+        mail_logger.info("All recipients were refused for message from %s", nym)
     except smtplib.SMTPHeloError:
-        mail_logger.warn("The SMTP server %s did not respond properly to HELO" % smtphost)
+        mail_logger.warn("The SMTP server %s did not respond properly to HELO", smtphost)
     except smtplib.SMTPSenderRefused:
-        mail_logger.info("The SMTP server %s refused sender %s" % (smtphost, from_hddr))
+        mail_logger.info("The SMTP server %s refused sender %s", smtphost, from_hddr)
     except smtplib.SMTPDataError:
-        mail_logger.warn("The SMTP server %s responded with an unexpected code" % smtphost)
+        mail_logger.warn("The SMTP server %s responded with an unexpected code", smtphost)
     except:
-        mail_logger.warn("An unexpected error occured in smtplib" % smtphost)
+        mail_logger.warn("An unexpected error occured in smtplib", smtphost)
     mailserver.quit()
 
 def relay_sendmail(payload, sm):
     """ Depreciated in favour of using Python smtplib, but this
     works fine on systems with sendmail"""
-    mail_logger.debug("Sending outgoing message using %s" % sm)
+    mail_logger.debug("Sending outgoing message using %s", sm)
     if not os.path.exists(sm):
-        mail_logger.warn("%s does not exist" % sm)
+        mail_logger.warn("%s does not exist", sm)
         sys.exit(2)
     p = os.popen("%s -t" % sm, "w")
     p.write(payload)
     status = p.close()
     if status:
-        mail_logger.warn("%s returned error %d" % (sm, status))
+        mail_logger.warn("%s returned error %d", sm, status)
         sys.exit(2)
     else:
-        mail_logger.debug("Message successfully relayed to %s" % sm)
+        mail_logger.debug("Message successfully relayed to %s", sm)
 
 def genMid(length = midLen):
     """Randomly generates a mid of given length different from oldestMid"""



More information about the Nym3-commit mailing list