From 2f6c0fbb2c49cad041a596f5f75200e6cc055ea0 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 26 Sep 2026 09:08:36 -0700 Subject: Add back logging again --- roseh.moe.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'roseh.moe.go') diff --git a/roseh.moe.go b/roseh.moe.go index ef4e219..5f24664 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -1099,6 +1099,15 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.h.ServeHTTP(w, r.WithContext(ctx)) } +type loggingHandler struct { + h http.Handler +} + +func (h *loggingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + log.Printf("%q from %q", r.Method+" "+r.Host+r.URL.String(), r.RemoteAddr) + h.h.ServeHTTP(w, r) +} + func main() { flag.Parse() @@ -1204,7 +1213,7 @@ func main() { codeMux.Handle("/", &timeoutHandler{h: cgitCGI, timeout: 5 * time.Minute}) serverMux.Handle("code."+selfURL.Hostname()+"/", &gzipHandler{codeMux}) server := &http.Server{ - Handler: serverMux, + Handler: &loggingHandler{serverMux}, ReadHeaderTimeout: 5 * time.Minute, IdleTimeout: 10 * time.Minute, -- cgit v1.3.1