aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2020-02-26 03:56:43 +0000
committerFelix Hanley <felix@userspace.com.au>2020-02-26 03:56:43 +0000
commite3733a11476f580709ed27f89464aaf83349288d (patch)
tree5dacf483b20e045127eb079ccb2822cdcd59cb2b
parent31cba05b4bf34f2c00993ee34f00129299e830c6 (diff)
downloadsws-e3733a11476f580709ed27f89464aaf83349288d.tar.gz
sws-e3733a11476f580709ed27f89464aaf83349288d.tar.bz2
Reduce logging
-rw-r--r--cmd/server/flash.go3
-rw-r--r--cmd/server/handlers.go1
-rw-r--r--cmd/server/hits.go1
-rw-r--r--cmd/server/main.go2
4 files changed, 1 insertions, 6 deletions
diff --git a/cmd/server/flash.go b/cmd/server/flash.go
index ce0ed04..230a64d 100644
--- a/cmd/server/flash.go
+++ b/cmd/server/flash.go
@@ -27,14 +27,11 @@ type flashMsg struct {
}
func flashSet(r *http.Request, l flashLvl, m string) *http.Request {
- debug("fetching existing flashes")
flashes := flashGet(r)
- debug("fetched existing flashes", flashes)
if flashes == nil {
flashes = make([]flashMsg, 0)
}
flashes = append(flashes, flashMsg{l, m})
- debug("adding flashes to context")
return r.WithContext(context.WithValue(r.Context(), flashCtxKey("flash"), flashes))
}
diff --git a/cmd/server/handlers.go b/cmd/server/handlers.go
index 85e3b48..d3d07d7 100644
--- a/cmd/server/handlers.go
+++ b/cmd/server/handlers.go
@@ -21,7 +21,6 @@ type templateData struct {
func newTemplateData(r *http.Request) *templateData {
out := &templateData{Flashes: flashGet(r)}
- log(out)
if user := r.Context().Value("user"); user != nil {
out.User = user.(*sws.User)
}
diff --git a/cmd/server/hits.go b/cmd/server/hits.go
index 8bb00e9..8c0d703 100644
--- a/cmd/server/hits.go
+++ b/cmd/server/hits.go
@@ -53,7 +53,6 @@ func handleHitCounter(db sws.CounterStore) http.HandlerFunc {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Content-Type", "image/gif")
w.Write(gifBytes)
- log("hit", hit)
return
}
}
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 5cdc201..6342585 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -254,7 +254,7 @@ func getUserCtx(db sws.UserStore) func(http.Handler) http.Handler {
http.Redirect(w, r, flashURL(r, "/login"), http.StatusUnauthorized)
return
}
- log("found user, adding to context")
+ debug("found user, adding to context")
ctx := context.WithValue(r.Context(), "user", user)
next.ServeHTTP(w, r.WithContext(ctx))
})