This commit is contained in:
zhang_heng 2025-07-16 02:37:00 +08:00
parent 59d260766b
commit aef79cb5fa
1 changed files with 4 additions and 5 deletions

View File

@ -9,14 +9,13 @@ from datetime import datetime
import json
import hmac
import hashlib
import logging
from loguru import logger
from fastapi.responses import PlainTextResponse
import os
from src.utils.websocket_logger_fixed import manager, test_websocket_logging
# 设置日志配置
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.add("logs/app.log", rotation="500 MB", retention="10 days")
def detect_webhook_source(data: dict, headers: dict) -> str:
"""检测webhook来源平台"""
@ -98,7 +97,7 @@ def get_webhook_event_info(data: dict, source: str) -> dict:
event_info["user"] = pr.get("user", {}).get("name", "unknown")
except Exception as e:
logger.error(f"解析webhook事件信息失败: {e}")
logger.error(f"解析webhook事件信息失败: {e}")
return event_info
@ -1000,7 +999,7 @@ async def logs_viewer():
@WEBHOOK.get("/health")
async def health_check():
"""健康检查接口"""
logger.info("💚 Webhook健康检查")
logger.info("💚 Webhook健康检查请求")
return {"status": "healthy", "message": "Webhook service is running"}
@WEBHOOK.post("/admin/logs/test")