Merge pull request #593 from Raithmir/main

Update logger to include UserAgent
This commit is contained in:
Toby Chui 2025-03-22 12:32:13 +08:00 committed by GitHub
commit 4d16758e0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,6 @@ func (l *Logger) LogHTTPRequest(r *http.Request, reqclass string, statusCode int
requestURI := r.RequestURI
statusCodeString := strconv.Itoa(statusCode)
//fmt.Println("[" + time.Now().Format("2006-01-02 15:04:05.000000") + "] [router:" + reqclass + "] [client " + clientIP + "] " + r.Method + " " + requestURI + " " + statusCodeString)
l.logger.Println("[" + time.Now().Format("2006-01-02 15:04:05.000000") + "] [router:" + reqclass + "] [origin:" + r.URL.Hostname() + "] [client " + clientIP + "] " + r.Method + " " + requestURI + " " + statusCodeString)
l.logger.Println("[" + time.Now().Format("2006-01-02 15:04:05.000000") + "] [router:" + reqclass + "] [origin:" + r.URL.Hostname() + "] [client: " + clientIP + "] [useragent: " + r.UserAgent() + "] " + r.Method + " " + requestURI + " " + statusCodeString)
}()
}