all repos — website @ fcc59c8caff01282e45191122c9fb5bb24e89fd7

My website

Disable stdout request logging in production
Alan Pearce alan@alanpearce.eu
Sat, 24 Aug 2024 17:52:55 +0200
commit

fcc59c8caff01282e45191122c9fb5bb24e89fd7

parent

26e6684674d56e01fdfc67c2e0ad57c331d8d0ab

1 files changed, 9 insertions(+), 5 deletions(-)

jump to
M internal/server/server.gointernal/server/server.go
@@ -204,11 +204,15 @@ } else { 		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)