Commit 29851c94 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

clean up formatting

parent 84343a87
......@@ -25,18 +25,20 @@ def __exit_handler(logger, notify):
if level not in notify:
notify[level] = []
# add the last uncaught exception that has occurred as an error, if present
tb_lines = traceback.format_exception(sys.last_type, sys.last_value, sys.last_traceback)
logging.error("Interpreter failure detected! Traceback follows:\n%s\n", ''.join(tb_lines))
tb_str = '\n'.join(['\t' + line.strip() for line in tb_lines])
logging.critical("Uncaught exception detected! Traceback follows:\n%s", tb_str)
except AttributeError:
logging.debug("No interpreter errors.")
if logger.has_errors():
addresses = notify['ERROR']
if logger.has_critical():
addresses = addresses.extend(notify['CRITICAL'])
if not addresses:
logging.warning('No recipients found. Email not sent')
logging.warning('There were errors, but no recipients specified. No email sent.')
addresses = list(set(addresses))
......@@ -44,7 +46,7 @@ def __exit_handler(logger, notify):
addresses = list(set(notify['DEBUG']))
logger.email_log(addresses, level=logging.DEBUG)
else:'No errors found. Email not sent')
logging.debug('No errors found, no email sent. All is well.')
class OperationalLogger:
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