Disable stdout request logging in production
Alan Pearce alan@alanpearce.eu
Sat, 24 Aug 2024 17:52:55 +0200
1 files changed, 9 insertions(+), 5 deletions(-)
jump to
M internal/server/server.go → internal/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)