mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
refactor(api_handler): improve logging format for API request handling
This commit is contained in:
parent
aac15c23c9
commit
1b2106697f
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user