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

ugly fix for unicode error

parent 5f6eb309
......@@ -144,13 +144,22 @@ class OperationalLogger:
logging.info("Sending log email to %s", addresses)
subject_prefix = "ERROR"
if level == logging.CRITICAL:
buf = self.__critical_buffer.getvalue()
try:
buf = self.__critical_buffer.getvalue()
except UnicodeDecodeError:
buf = self.__critical_buffer.getvalue().decode('utf8')
subject_prefix = "CRITICAL"
elif level == logging.DEBUG:
buf = self.__debug_buffer.getvalue()
try:
buf = self.__debug_buffer.getvalue()
except UnicodeDecodeError:
buf = self.__debug_buffer.getvalue().decode('utf8')
subject_prefix = "debug"
else:
buf = self.__error_buffer.getvalue()
try:
buf = self.__error_buffer.getvalue()
except UnicodeDecodeError:
buf = self.__error_buffer.getvalue().decode('utf8')
message = "<br />\n".join([self.__class__.__colorize(line) for line in buf.split('\n')])
OperationalMail.send_status(subject='[{}] Log for {}:{}'.format(subject_prefix, self.__server_name,
os.path.basename(sys.argv[0])),
......
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