def log(self, *args):
"""log arguments as a message followed by a newline"""
# build string and output, as this minimize interleaved messages
# discard output on I/O errors
try:
msg = []
if self.inclPid:
msg.append(str(os.getpid()))
msg.append(": ")
if self.inclThread:
# can only include id, getting name will cause deadlock
msg.append(str(threading._get_ident()))
msg.append(": ")
for a in args:
msg.append(str(a))
msg.append("\n")
self.fh.write("".join(msg))
self.fh.flush()
except IOError as ex:
pass
trace.py 文件源码
python
阅读 31
收藏 0
点赞 0
评论 0
评论列表
文章目录