From fcc59c8caff01282e45191122c9fb5bb24e89fd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 Aug 2024 17:52:55 +0200 Subject: Disable stdout request logging in production --- internal/server/server.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'internal/server') 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) -- cgit 1.4.1