about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-08-24 17:52:55 +0200
committerAlan Pearce2024-08-24 17:52:55 +0200
commitfcc59c8caff01282e45191122c9fb5bb24e89fd7 (patch)
tree8a1bb9c3c899c0d3a9e3d4bd939aa925f7d752a9
parent26e6684674d56e01fdfc67c2e0ad57c331d8d0ab (diff)
downloadwebsite-fcc59c8caff01282e45191122c9fb5bb24e89fd7.tar.lz
website-fcc59c8caff01282e45191122c9fb5bb24e89fd7.tar.zst
website-fcc59c8caff01282e45191122c9fb5bb24e89fd7.zip
Disable stdout request logging in production
-rw-r--r--internal/server/server.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 5c92139..269ed9e 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -204,11 +204,15 @@ func New(runtimeConfig *Config, log *log.Logger) (*Server, error) {
 		loggingMux.Handle("/", mux)
 	}
 
-	top.Handle("/",
-		serverHeaderHandler(
-			wrapHandlerWithLogging(loggingMux, log),
-		),
-	)
+	if runtimeConfig.Development {
+		top.Handle("/",
+			serverHeaderHandler(
+				wrapHandlerWithLogging(loggingMux, log),
+			),
+		)
+	} else {
+		top.Handle("/", serverHeaderHandler(loggingMux))
+	}
 
 	top.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) {
 		w.WriteHeader(http.StatusNoContent)