diff --git a/itchatmp/log.py b/itchatmp/log.py index 1843505..078c675 100644 --- a/itchatmp/log.py +++ b/itchatmp/log.py @@ -31,6 +31,8 @@ def set_logging(self, showOnCmd=True, loggingFile=None, self.fileHandler.close() if loggingFile is not None: # add new fileHandler self.fileHandler = logging.FileHandler(loggingFile) + formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') + self.fileHandler.setFormatter(formatter) self.logger.addHandler(self.fileHandler) self.loggingFile = loggingFile if loggingLevel != self.loggingLevel: