Skip to content

Commit e29e341

Browse files
committed
router logger did not show username in /render calls because cookies are
cleared in these call. Not just get username before the call is executed. see grafana#3405 for more info.
1 parent a7d7f31 commit e29e341

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)