Skip to content

Commit 9cd4519

Browse files
committed
Added timing information to the send_smtp() log entries.
- Legacy-Id: 18628
1 parent e97b5e2 commit 9cd4519

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ietf/utils/mail.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def send_smtp(msg, bcc=None):
9090
If someone has set test_mode=True, then append the msg to
9191
the outbox.
9292
'''
93+
mark = time.time()
9394
add_headers(msg)
9495
(fname, frm) = parseaddr(msg.get('From'))
9596
addrlist = msg.get_all('To') + msg.get_all('Cc', [])
@@ -137,7 +138,8 @@ def send_smtp(msg, bcc=None):
137138
except smtplib.SMTPServerDisconnected:
138139
pass
139140
subj = force_text(msg.get('Subject', '[no subject]'))
140-
log("sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), subj))
141+
tau = time.time() - mark
142+
log("sent email (%.3fs) from '%s' to %s id %s subject '%s'" % (tau, frm, to, msg.get('Message-ID', ''), subj))
141143

142144
def copy_email(msg, to, toUser=False, originalBcc=None):
143145
'''

0 commit comments

Comments
 (0)