|
|
|
@@ -115,20 +115,13 @@ func RouterHandler(level log.Level) func(ctx *macaron.Context) { |
|
|
|
|
|
|
|
// SetLogMsgID set msgID in Context |
|
|
|
func SetLogMsgID() macaron.Handler { |
|
|
|
return func(ctx *macaron.Context, sess session.Store) { |
|
|
|
return func(ctx *macaron.Context) { |
|
|
|
start := time.Now() |
|
|
|
|
|
|
|
uuid := gouuid.NewV4().String() |
|
|
|
ctx.Data["MsgID"] = uuid |
|
|
|
|
|
|
|
// Get user from session if logged in. |
|
|
|
user, _ := auth.SignedInUser(ctx, sess) |
|
|
|
var username string |
|
|
|
if user != nil { |
|
|
|
username = user.Name |
|
|
|
} |
|
|
|
|
|
|
|
log.Info("%s Started %s %s for %s", username, log.ColoredMethod(ctx.Req.Method), ctx.Req.URL.RequestURI(), ctx.RemoteAddr(), ctx.Data["MsgID"]) |
|
|
|
log.Info("%s Started %s %s for %s", ctx.Data["SignedUserName"], log.ColoredMethod(ctx.Req.Method), ctx.Req.URL.RequestURI(), ctx.RemoteAddr(), ctx.Data["MsgID"]) |
|
|
|
|
|
|
|
rw := ctx.Resp.(macaron.ResponseWriter) |
|
|
|
ctx.Next() |
|
|
|
|