refactor(api_handler): improve logging format for API request handling

This commit is contained in:
wood chen 2024-11-03 08:14:50 +08:00
parent aac15c23c9
commit 1b2106697f

View File

@ -82,6 +82,15 @@ func HandleAPIRequest(w http.ResponseWriter, r *http.Request) {
log.Printf("请求:%s %s来自 %s -来源:%s -持续时间: %v - 重定向至: %s",
r.Method, r.URL.Path, realIP, sourceInfo, duration, randomURL)
log.Printf(" %12s | %15s | %-6s | %-50s | %s | %-50s",
duration, // 持续时间
realIP, // 真实IP
r.Method, // HTTP方法
r.URL.Path, // 请求路径
sourceInfo, // 来源信息
randomURL, // 重定向URL
)
http.Redirect(w, r, randomURL, http.StatusFound)
}