Commit 5f6eb309 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

improve email subject

parent 01c315c7
......@@ -142,14 +142,17 @@ class OperationalLogger:
if from_address is None:
from_address = self.__from_address
logging.info("Sending log email to %s", addresses)
subject_prefix = "ERROR"
if level == logging.CRITICAL:
buf = self.__critical_buffer.getvalue()
subject_prefix = "CRITICAL"
elif level == logging.DEBUG:
buf = self.__debug_buffer.getvalue()
subject_prefix = "debug"
else:
buf = self.__error_buffer.getvalue()
message = "<br />\n".join([self.__class__.__colorize(line) for line in buf.split('\n')])
OperationalMail.send_status(subject='Errors detected {}:{}'.format(self.__server_name,
OperationalMail.send_status(subject='[{}] Log for {}:{}'.format(subject_prefix, self.__server_name,
os.path.basename(sys.argv[0])),
message=message, to_list=addresses, from_address=from_address,
text_attachment=self.__debug_buffer.getvalue())
......
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