mirror of
https://github.com/chaitin/SafeLine.git
synced 2025-11-25 11:29:46 +08:00
fix: log format
This commit is contained in:
@@ -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")
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user