diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-31 04:36:31 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-31 04:36:31 -0400 |
commit | 35965092fa3988844f3ed45627cd0d37a6371ae3 (patch) | |
tree | 756dd9a7db8848e0075c02ded026585fb7a51b55 /http.go | |
parent | 4fa97eec3910f22159e51c2742049a5769a8f0a0 (diff) | |
download | getwtxt-35965092fa3988844f3ed45627cd0d37a6371ae3.tar.gz |
bugfix: more incorrectly logged errors
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/http.go b/http.go index f4ba233..725f4c5 100644 --- a/http.go +++ b/http.go @@ -61,7 +61,7 @@ func log200(r *http.Request) { func log400(w http.ResponseWriter, r *http.Request, err string) { uip := getIPFromCtx(r.Context()) - log.Printf("*** %v :: 400 :: %v %v :: %v\n", uip, r.Method, r.URL, err) + log.Printf("*** %v :: 400 :: %v %v :: %v\n", uip, r.Method, r.URL, err.Error()) http.Error(w, "400 Bad Request: "+err, http.StatusBadRequest) } @@ -69,7 +69,7 @@ func log404(w http.ResponseWriter, r *http.Request, err error) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) - log.Printf("*** %v :: 404 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err) + log.Printf("*** %v :: 404 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err.Error()) http.Error(w, err.Error(), http.StatusNotFound) } @@ -77,6 +77,6 @@ func log500(w http.ResponseWriter, r *http.Request, err error) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) - log.Printf("*** %v :: 500 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err) + log.Printf("*** %v :: 500 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) } |