diff --git a/playground/playgrounds.go b/playground/playgrounds.go index bbba44b..dd61cd4 100644 --- a/playground/playgrounds.go +++ b/playground/playgrounds.go @@ -39,13 +39,11 @@ var logger = log.NewLogger(os.Stdout) // IndexHandler handles request of Playground index. func IndexHandler(w http.ResponseWriter, r *http.Request) { - username := "playground" - // create a HTTP session httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { httpSession.Values["id"] = strconv.Itoa(rand.Int()) - httpSession.Values["username"] = username + httpSession.Values["username"] = "playground" } httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge @@ -54,6 +52,8 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { } httpSession.Save(r, w) + username := httpSession.Values["username"].(string) + // create a wide session rand.Seed(time.Now().UnixNano()) sid := strconv.Itoa(rand.Int()) @@ -87,7 +87,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { wideSessions := session.WideSessions.GetByUsername(username) - logger.Tracef("User [%s] has [%d] sessions", username, len(wideSessions)) + logger.Debugf("User [%s] has [%d] sessions", username, len(wideSessions)) t, err := template.ParseFiles("views/playground/index.html") diff --git a/session/sessions.go b/session/sessions.go index 5445c8d..c7399ed 100644 --- a/session/sessions.go +++ b/session/sessions.go @@ -386,7 +386,7 @@ func (sessions *wSessions) Remove(sid string) { } } - logger.Tracef("Removed a session [%s] of user [%s], it has [%d] sessions currently", sid, s.Username, cnt) + logger.Debugf("Removed a session [%s] of user [%s], it has [%d] sessions currently", sid, s.Username, cnt) return }