Commit f85f4775 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

fix bug where critical logs not being sent to debug address

parent 2984a6d4
......@@ -24,6 +24,8 @@ def __exit_handler(logger, notify):
for level in 'DEBUG', 'ERROR', 'CRITICAL':
if level not in notify:
notify[level] = []
elif type(notify[level]) is str:
notify[level] = [notify[level]]
# add the last uncaught exception that has occurred as an error, if present
......@@ -35,15 +37,18 @@ def __exit_handler(logger, notify):
if logger.has_errors():
addresses = notify['ERROR']
print "before addresses:", addresses
if notify['DEBUG']:
if logger.has_critical():
if logger.has_critical() and notify['CRITICAL']:
addresses = addresses.extend(notify['CRITICAL'])
if not addresses:
logging.warning('There were errors, but no recipients specified. No email sent.')
addresses = list(set(addresses))
print "after addresses", addresses
print "notify =", notify
elif notify['DEBUG']:
addresses = list(set(notify['DEBUG']))
logger.email_log(addresses, level=logging.DEBUG)
......@@ -42,7 +42,7 @@ class TestExit(unittest.TestCase):
temp_buffer = logging.StreamHandler(s)
h = logging.getLogger().addHandler(temp_buffer)
assert "No recipients found. Email not sent" in s.getvalue()
assert "no email sent" in s.getvalue().lower()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment