Skip to content

Commit fabaf5c

Browse files
committed
Merge pull request grafana#3575 from piotr1212/no_username_in_render_logging
Fix empty username in http log for /render calls
2 parents 1b341f8 + e29e341 commit fabaf5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/middleware/logger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ func Logger() macaron.Handler {
2929
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
3030
start := time.Now()
3131

32-
rw := res.(macaron.ResponseWriter)
33-
c.Next()
34-
3532
uname := c.GetCookie(setting.CookieUserName)
3633
if len(uname) == 0 {
3734
uname = "-"
3835
}
3936

37+
rw := res.(macaron.ResponseWriter)
38+
c.Next()
39+
4040
content := fmt.Sprintf("Completed %s %s \"%s %s %s\" %v %s %d bytes in %dus", c.RemoteAddr(), uname, req.Method, req.URL.Path, req.Proto, rw.Status(), http.StatusText(rw.Status()), rw.Size(), time.Since(start)/time.Microsecond)
4141

4242
switch rw.Status() {

0 commit comments

Comments
 (0)