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

Method GetProjectLog

class/projectModel/pythonModel.py:1598–1615  ·  view source on GitHub ↗

获取项目日志api @author baozi <202-02-22> @param: get ( dict ): 请求信息,需要包含项目名称 @return msg : 日志信息

(self, get)

Source from the content-addressed store, hash-verified

1596 return log_file
1597
1598 def GetProjectLog(self, get):
1599 """获取项目日志api
1600 @author baozi <202-02-22>
1601 @param:
1602 get ( dict ): 请求信息,需要包含项目名称
1603 @return msg : 日志信息
1604 """
1605 project_conf = self._get_project_conf(get.name.strip())
1606 if not project_conf: return public.returnMsg(False, '项目不存在')
1607 log_file = self._project_logfile(project_conf)
1608 if not os.path.exists(log_file):
1609 return public.returnMsg(False, '日志文件不存在')
1610 log_file_size = os.path.getsize(log_file)
1611 if log_file_size > 3145928:
1612 return {"status": True, "path": log_file, "data": self.xsssec(self.last_lines(log_file, 3000)),
1613 "size": public.to_size(log_file_size)}
1614 return {"status": True, "path": log_file, "data": self.xsssec(public.GetNumLines(log_file, 3000)),
1615 "size": public.to_size(log_file_size)}
1616
1617
1618 def GetProjectList(self, get):

Callers 1

get_logMethod · 0.80

Calls 8

_get_project_confMethod · 0.95
_project_logfileMethod · 0.95
xsssecMethod · 0.95
last_linesMethod · 0.95
returnMsgMethod · 0.80
GetNumLinesMethod · 0.80
existsMethod · 0.45
to_sizeMethod · 0.45

Tested by

no test coverage detected