MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / WriteLogs

Method WriteLogs

class/plugin_deployment.py:367–386  ·  view source on GitHub ↗
(self, msg)

Source from the content-addressed store, hash-verified

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):

Callers 10

DownloadFileMethod · 0.95
DownloadHookMethod · 0.95
set_catchadmin_confMethod · 0.95
SetupPackageMethod · 0.95
start_java_projectMethod · 0.95
set_temp_fileMethod · 0.95
GetJarPathMethod · 0.95

Calls 7

writeFileMethod · 0.80
GetNumLinesMethod · 0.80
readFileMethod · 0.80
findMethod · 0.45
formatMethod · 0.45
dumpsMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected