refactor: don't log request Host, it's irrelevant to this server
Alan Pearce alan@alanpearce.eu
Sat, 25 May 2024 18:10:06 +0200
1 files changed, 1 insertions(+), 6 deletions(-)
jump to
M internal/server/logging.go → internal/server/logging.go
@@ -51,20 +51,15 @@ scheme := r.Header.Get("X-Forwarded-Proto") if scheme == "" { scheme = "http" } - host := r.Host - if host == "" { - host = opts.defaultHostname - } lw := NewLoggingResponseWriter(w) wrappedHandler.ServeHTTP(lw, r) statusCode := lw.statusCode fmt.Fprintf( opts.logger, - "%s %s %d %s %s %s\n", + "%s %s %d %s %s\n", scheme, r.Method, statusCode, - host, r.URL.Path, lw.Header().Get("Location"), )