Skip to content

Commit

Permalink
Add missing user identifier part
Browse files Browse the repository at this point in the history
  • Loading branch information
aviddiviner committed Jun 21, 2016
1 parent 0ec5111 commit 99eab74
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions commonlog/commonlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,19 @@ func NewWithWriter(out io.Writer) gin.HandlerFunc {
},
}
return func(c *gin.Context) {
path := c.Request.URL.Path

// Process request
c.Next()

//127.0.0.1 user-identifier frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
w := pool.Get().(*bytes.Buffer)
w.Reset()
w.WriteString(c.ClientIP())
w.WriteString(" ")
w.WriteString(" - - ")
w.WriteString(time.Now().Format("[02/Jan/2006:15:04:05 -0700] "))
w.WriteString("\"")
w.WriteString(c.Request.Method)
w.WriteString(" ")
w.WriteString(path)
w.WriteString(c.Request.URL.Path)
w.WriteString(" ")
w.WriteString(c.Request.Proto)
w.WriteString("\" ")
Expand Down

0 comments on commit 99eab74

Please sign in to comment.