From 9cd45195efe33aa293fa682dfc918eca0b1e21b4 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Fri, 23 Oct 2020 13:36:44 +0000 Subject: [PATCH] Added timing information to the send_smtp() log entries. - Legacy-Id: 18628 --- ietf/utils/mail.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index d10f082f9..52fedd5c7 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -90,6 +90,7 @@ def send_smtp(msg, bcc=None): If someone has set test_mode=True, then append the msg to the outbox. ''' + mark = time.time() add_headers(msg) (fname, frm) = parseaddr(msg.get('From')) addrlist = msg.get_all('To') + msg.get_all('Cc', []) @@ -137,7 +138,8 @@ def send_smtp(msg, bcc=None): except smtplib.SMTPServerDisconnected: pass subj = force_text(msg.get('Subject', '[no subject]')) - log("sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), subj)) + tau = time.time() - mark + log("sent email (%.3fs) from '%s' to %s id %s subject '%s'" % (tau, frm, to, msg.get('Message-ID', ''), subj)) def copy_email(msg, to, toUser=False, originalBcc=None): '''