From ba8dc0186332f68868c2c3dc0f71a10b93d460dc Mon Sep 17 00:00:00 2001 From: xoy Date: Sat, 28 Jan 2023 22:28:31 +0100 Subject: [PATCH] logging erweitert --- http.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/http.go b/http.go index 6e68c09..ac5bf76 100644 --- a/http.go +++ b/http.go @@ -6,8 +6,10 @@ import ( ) func httpHandleFunc(urlPath string, filepath string, contentType string) { - logger(readHttpYML() + "/" + urlPath + " - " + filepath + " " + contentType) + logger(readHttpYML() + "/" + urlPath + " - " + filepath + " <" + contentType + ">") http.HandleFunc("/"+urlPath, func(w http.ResponseWriter, r *http.Request) { + logger(r.Method + " - request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">") + w.Header().Add("Content-Type", contentType) io.WriteString(w, htmlReplacer(fileRead(filepath), urlPath)) @@ -15,7 +17,7 @@ func httpHandleFunc(urlPath string, filepath string, contentType string) { } func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string) { - logger(readHttpYML() + "/" + urlPath + " - " + filepath + " " + contentType) + logger(readHttpYML() + "/" + urlPath + " - " + filepath + " <" + contentType + ">") s := new(submit) s.data = "null" http.HandleFunc("/"+urlPath, func(w http.ResponseWriter, r *http.Request) { @@ -24,6 +26,8 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string) errorPanic(err) } + logger(r.Method + " - request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">") + w.Header().Add("Content-Type", contentType) io.WriteString(w, htmlReplacer(fileRead(filepath), urlPath))