[Add]将日志文件改为UTF8编码,Close #1248

This commit is contained in:
vn.py 2018-11-17 22:21:35 +08:00
parent 3fee9cb48e
commit 31784f32b6

View File

@ -700,7 +700,7 @@ class LogEngine(object):
if not filename: if not filename:
filename = 'vt_' + datetime.now().strftime('%Y%m%d') + '.log' filename = 'vt_' + datetime.now().strftime('%Y%m%d') + '.log'
filepath = getTempPath(filename) filepath = getTempPath(filename)
self.fileHandler = logging.FileHandler(filepath) self.fileHandler = logging.FileHandler(filepath, mode='w', encoding='utf-8')
self.fileHandler.setLevel(self.level) self.fileHandler.setLevel(self.level)
self.fileHandler.setFormatter(self.formatter) self.fileHandler.setFormatter(self.formatter)
self.logger.addHandler(self.fileHandler) self.logger.addHandler(self.fileHandler)