fix: log format

This commit is contained in:
姚凯
2025-04-03 19:09:38 +08:00
committed by xbingW
parent 850fd440ff
commit 38f00302bf
3 changed files with 9 additions and 7 deletions

View File

@@ -53,4 +53,4 @@ def set_log_level():
case "critical":
level = logging.CRITICAL
logging.basicConfig(level=level)
logging.basicConfig(level=level, format="%(asctime)s - %(levelname)s - %(message)s")

View File

@@ -5,7 +5,6 @@ from starlette.applications import Starlette
from starlette.routing import Route, Mount
from starlette.requests import Request
import uvicorn
from starlette.responses import PlainTextResponse
from tools import tools
from config import GLOBAL_CONFIG
from middleware import AuthenticationMiddleware

View File

@@ -19,8 +19,11 @@ async def post_slce_api(path: str,req_body: dict) -> str:
if not path.startswith("/"):
path = f"/{path}"
async with AsyncClient(verify=False) as client:
response = await client.post(f"{GLOBAL_CONFIG.SAFELINE_ADDRESS}{path}", json=req_body, headers={
"X-SLCE-API-TOKEN": f"{GLOBAL_CONFIG.SAFELINE_API_TOKEN}"
})
return check_slce_response(response)
try:
async with AsyncClient(verify=False) as client:
response = await client.post(f"{GLOBAL_CONFIG.SAFELINE_ADDRESS}{path}", json=req_body, headers={
"X-SLCE-API-TOKEN": f"{GLOBAL_CONFIG.SAFELINE_API_TOKEN}"
})
return check_slce_response(response)
except Exception as e:
return str(e)