def _emit(self, record):
msg = self.format(record)
fs = "%s\n"
if hasattr(record, '__nonewline__'):
msg = msg.rstrip()
fs = "%s"
stream = self.stream
if record.levelno in [ERROR, CRITICAL, FATAL]:
stream = self.error_stream
if not hasattr(types, "UnicodeType"):
# if no unicode support...
stream.write(fs % msg)
else:
try:
stream.write(fs % msg)
except UnicodeError:
stream.write(fs % msg.encode("UTF-8"))
self.flush()
评论列表
文章目录