Clean up logging

This commit is contained in:
2021-10-10 14:54:08 +10:30
parent 3776374747
commit ec8b2453cd
3 changed files with 9 additions and 12 deletions

View File

@@ -45,15 +45,13 @@ func (ws *WebService) getStatic(w http.ResponseWriter, r *http.Request) {
if extension == ".html" { // html file
t, err := template.ParseFS(webFS, "data/wrapper.tmpl", "data/"+path)
if err != nil {
log.Printf("when fetching: %s got: %s", path, err)
daulog.SendLog(fmt.Sprintf("when fetching: %s got: %s", path, err), daulog.LogTypeError)
w.Header().Add("Content-Type", "text/plain")
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("not found"))
return
}
log.Printf("req: %s", r.URL.Path)
var b struct {
Body string
Path string
@@ -71,7 +69,7 @@ func (ws *WebService) getStatic(w http.ResponseWriter, r *http.Request) {
otherStatic, err := webFS.ReadFile("data/" + path)
if err != nil {
log.Printf("when fetching: %s got: %s", path, err)
daulog.SendLog(fmt.Sprintf("when fetching: %s got: %s", path, err), daulog.LogTypeError)
w.Header().Add("Content-Type", "text/plain")
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("not found"))