flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit e7763a0743e1b07d9e9b6925848975597bdfd3f3
parent e6d27a6a56bc9bd140c233643855288ca1aa6f42
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 21 Oct 2020 22:50:11 -0700

Add basic logger

Diffstat:
Mhttp.go | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/http.go b/http.go @@ -88,5 +88,11 @@ func runHTTPServer() { // http.HandleFunc("/delete/", deleteFileHandler) // login+register functions http.HandleFunc("/", userFile) - log.Fatal(http.ListenAndServe(":8080", nil)) + log.Fatal(http.ListenAndServe(":8080", logRequest(http.DefaultServeMux))) +} + +func logRequest(handler http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL) + }) }