Don't traceback when writing zero-length message

This commit is contained in:
Dan Williams 2007-08-28 14:54:54 -04:00
parent 232ae8d082
commit f0e773db38

View File

@ -57,7 +57,7 @@ class LogWriter:
elif level == STDOUT_LEVEL: elif level == STDOUT_LEVEL:
level_txt = 'STDOUT' level_txt = 'STDOUT'
if msg[len(msg) - 1] != '\n': if not len(msg) or msg[len(msg) - 1] != '\n':
msg += "\n" msg += "\n"
fmt = "%.4f %s - %s" % (time.time(), level_txt, msg) fmt = "%.4f %s - %s" % (time.time(), level_txt, msg)
fmt = fmt.encode("utf8") fmt = fmt.encode("utf8")