(self, msg)
| 365 | |
| 366 | # 写输出日志 |
| 367 | def WriteLogs(self, msg): |
| 368 | if msg.find('ERROR:') != -1 or msg.find('Success:') != -1: |
| 369 | public.writeFile(self.logPath, '{}\n'.format(msg), 'a+') |
| 370 | status = False |
| 371 | if msg.find('Success:') != -1: |
| 372 | status = True |
| 373 | data = { |
| 374 | 'status': status, |
| 375 | 'msg': msg, |
| 376 | 'data': public.GetNumLines(self.logPath, 100) |
| 377 | } |
| 378 | public.writeFile(self.logPath, json.dumps(data)) |
| 379 | else: |
| 380 | try: |
| 381 | logs = public.readFile(self.logPath) |
| 382 | data = json.loads(logs) |
| 383 | data['data'] = '{}\n{}'.format(data['data'], msg) |
| 384 | public.writeFile(self.logPath, json.dumps(data)) |
| 385 | except: |
| 386 | public.writeFile(self.logPath, '{}\n'.format(msg), 'a+') |
| 387 | |
| 388 | # 需要特殊处理的项目 |
| 389 | def set_complex_conf(self, get, path, find): |
no test coverage detected