From 1f7fbc601bed676b04edf817497fa8947249f144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Tikvi=C4=87?= Date: Mon, 22 Oct 2018 09:32:59 +0200 Subject: [PATCH] logging user ID --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index cf5a807..0c92dc1 100644 --- a/main.go +++ b/main.go @@ -81,20 +81,20 @@ func (l *Logger) Log(format string, v ...interface{}) { l.outputFile.WriteString(s) } -func (l *Logger) RequestLog(req *http.Request, userid string) string { +func (l *Logger) RequestLog(req *http.Request, userID string) string { if l.outputFile == nil { return "" } - if userid == "" { - userid = "-" + if userID == "" { + userID = "-" } var b strings.Builder b.WriteString("Request:\n") // CLF-like header ts := time.Now().Format(time.RFC3339) - fmt.Fprintf(&b, "%s %s\n", req.RemoteAddr, ts) + fmt.Fprintf(&b, "%s %s %s\n", req.RemoteAddr, userID, ts) headers := req.Header content := headers.Get("Content-Type") -- 1.8.1.2