From 60a684836145014b0a5c8e946a594cd3d7c0b399 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 1 Jul 2019 16:45:35 -0400 Subject: [PATCH] Fix userlevel error logging Previously, we just included the value of `ul`, which is a func. This now calls `ul()` and logs that value. --- handle.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handle.go b/handle.go index f7ea69b..4f137b9 100644 --- a/handle.go +++ b/handle.go @@ -390,7 +390,7 @@ func (h *Handler) WebErrors(f handlerFunc, ul UserLevelFunc) http.HandlerFunc { session, err = h.sessionStore.Get(r, cookieName) if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) { // 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) @@ -479,7 +479,7 @@ func (h *Handler) Web(f handlerFunc, ul UserLevelFunc) http.HandlerFunc { session, err := h.sessionStore.Get(r, cookieName) if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) { // 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) @@ -662,7 +662,7 @@ func (h *Handler) Redirect(url string, ul UserLevelFunc) http.HandlerFunc { session, err := h.sessionStore.Get(r, cookieName) if err != nil && (ul(h.app.App().cfg) == UserLevelNoneRequiredType || ul(h.app.App().cfg) == UserLevelUserType) { // 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)