all repos — flounder @ e7763a0743e1b07d9e9b6925848975597bdfd3f3

A small site builder for the Gemini protocol

Add basic logger
alex wennerberg alex@alexwennerberg.com
Wed, 21 Oct 2020 22:50:11 -0700
commit

e7763a0743e1b07d9e9b6925848975597bdfd3f3

parent

e6d27a6a56bc9bd140c233643855288ca1aa6f42

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M http.gohttp.go

@@ -88,5 +88,11 @@ http.HandleFunc(c.RootDomain+"/edit/", editFileHandler)

// 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) + }) }