删除多余打印
This commit is contained in:
2
.idea/iOSAI.iml
generated
2
.idea/iOSAI.iml
generated
@@ -2,7 +2,7 @@
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.12 (IOS-AI)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,5 +3,5 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (IOS-AI)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
@@ -312,14 +312,13 @@ def monitorMessages():
|
||||
|
||||
|
||||
@app.route("/setLoginInfo", methods=['POST'])
|
||||
def upLoadLogFile():
|
||||
def upLoadLogLogs():
|
||||
data = request.get_json() # 解析 JSON
|
||||
token = data.get("token")
|
||||
userId = data.get("userId")
|
||||
tenantId = data.get("tenantId")
|
||||
ok = LogManager.upload_all_logs("http://47.79.98.113:8101/api/log/upload", token, userId, tenantId)
|
||||
if ok:
|
||||
print(123)
|
||||
return ResultData(data="日志上传成功").toJson()
|
||||
else:
|
||||
return ResultData(data="", msg="日志上传失败").toJson()
|
||||
|
||||
@@ -235,7 +235,6 @@ class LogManager:
|
||||
@classmethod
|
||||
def clearLogs(cls):
|
||||
"""启动时清空 log 目录下所有文件"""
|
||||
print("开始清空日志...")
|
||||
|
||||
# 关闭所有 handler
|
||||
for name, logger in logging.Logger.manager.loggerDict.items():
|
||||
@@ -258,13 +257,11 @@ class LogManager:
|
||||
|
||||
# 清缓存
|
||||
cls._method_loggers.clear()
|
||||
print("日志清空完成")
|
||||
|
||||
@classmethod
|
||||
def upload_all_logs(cls, server_url, token, userId, tenantId):
|
||||
log_path = Path(cls.logDir)
|
||||
if not log_path.exists():
|
||||
print("[upload_all_logs] 日志目录不存在")
|
||||
return False
|
||||
|
||||
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
@@ -286,20 +283,9 @@ class LogManager:
|
||||
files = {
|
||||
"file": (filename, io.BytesIO(zip_bytes), "application/zip")
|
||||
}
|
||||
print(
|
||||
f"[upload_all_logs] "
|
||||
f"server={server_url} (type={type(server_url)}) "
|
||||
f"tenantId={tenantId} (type={type(tenantId)}) "
|
||||
f"userId={userId} (type={type(userId)}) "
|
||||
f"token={token} (type={type(token)})"
|
||||
)
|
||||
|
||||
print("开始上传")
|
||||
# 3) 上传
|
||||
resp = requests.post(server_url, headers=headers, data=data, files=files)
|
||||
print(resp.text)
|
||||
print("上传结束")
|
||||
|
||||
if resp.json()['data']:
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user