mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 11:24:13 +00:00
Fix userlevel error logging
Previously, we just included the value of `ul`, which is a func. This now calls `ul()` and logs that value.
This commit is contained in:
parent
77bf403443
commit
60a6848361
1 changed files with 3 additions and 3 deletions
|
@ -390,7 +390,7 @@ func (h *Handler) WebErrors(f handlerFunc, ul UserLevelFunc) http.HandlerFunc {
|
||||||
session, err = h.sessionStore.Get(r, cookieName)
|
session, err = h.sessionStore.Get(r, cookieName)
|
||||||
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
||||||
// Cookie is required, but we can ignore this error
|
// Cookie is required, but we can ignore this error
|
||||||
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul, err)
|
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul(h.app.App().cfg), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, gotUser := session.Values[cookieUserVal].(*User)
|
_, gotUser := session.Values[cookieUserVal].(*User)
|
||||||
|
@ -479,7 +479,7 @@ func (h *Handler) Web(f handlerFunc, ul UserLevelFunc) http.HandlerFunc {
|
||||||
session, err := h.sessionStore.Get(r, cookieName)
|
session, err := h.sessionStore.Get(r, cookieName)
|
||||||
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
||||||
// Cookie is required, but we can ignore this error
|
// Cookie is required, but we can ignore this error
|
||||||
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul, err)
|
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul(h.app.App().cfg), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, gotUser := session.Values[cookieUserVal].(*User)
|
_, gotUser := session.Values[cookieUserVal].(*User)
|
||||||
|
@ -662,7 +662,7 @@ func (h *Handler) Redirect(url string, ul UserLevelFunc) http.HandlerFunc {
|
||||||
session, err := h.sessionStore.Get(r, cookieName)
|
session, err := h.sessionStore.Get(r, cookieName)
|
||||||
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) {
|
||||||
// Cookie is required, but we can ignore this error
|
// Cookie is required, but we can ignore this error
|
||||||
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul, err)
|
log.Error("Handler: Unable to get session (for user permission %d); ignoring: %v", ul(h.app.App().cfg), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, gotUser := session.Values[cookieUserVal].(*User)
|
_, gotUser := session.Values[cookieUserVal].(*User)
|
||||||
|
|
Loading…
Reference in a new issue