Let's use os.linesep instead.

This commit is contained in:
Jeremy Fincher 2004-09-08 22:48:53 +00:00
parent b3dfdd1ed5
commit dee61a32f1

View File

@ -118,12 +118,15 @@ class BetterFileHandler(logging.FileHandler):
def emit(self, record): def emit(self, record):
msg = self.format(record) msg = self.format(record)
if not hasattr(types, "UnicodeType"): #if no unicode support... if not hasattr(types, "UnicodeType"): #if no unicode support...
self.stream.write("%s\n" % msg) self.stream.write(msg)
self.stream.write(os.linesep)
else: else:
try: try:
self.stream.write("%s\n" % msg) self.stream.write(msg)
self.stream.write(os.linesep)
except UnicodeError: except UnicodeError:
self.stream.write("%s\n" % msg.encode("UTF-8")) self.stream.write(msg.encode("utf8"))
self.stream.write(os.linesep)
self.flush() self.flush()