diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-12 21:35:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-12 21:35:52 -0400 |
commit | a2d5115725dea018edb8a8dbaf3c622fabe2680e (patch) | |
tree | cacbd836373239b0b3f5b8ce25fc642ce43179a6 /svc/http.go | |
parent | be76daaa8b4e6f6d5f60c79ecd84a8d034cbe351 (diff) | |
parent | fbfe7f582979c9db9089187b7316013bd0b1d423 (diff) | |
download | getwtxt-a2d5115725dea018edb8a8dbaf3c622fabe2680e.tar.gz |
Merge pull request #8 from getwtxt/multiple-logfiles
Using separate log files for requests and other messages
Diffstat (limited to 'svc/http.go')
-rw-r--r-- | svc/http.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/svc/http.go b/svc/http.go index d39ab4e..95cb613 100644 --- a/svc/http.go +++ b/svc/http.go @@ -62,12 +62,12 @@ func ipMiddleware(hop http.Handler) http.Handler { func log200(r *http.Request) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) - log.Printf("*** %v :: 200 :: %v %v :: %v\n", uip, r.Method, r.URL, useragent) + reqLog.Printf("*** %v :: 200 :: %v %v :: %v\n", uip, r.Method, r.URL, useragent) } func errHTTP(w http.ResponseWriter, r *http.Request, err error, code int) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) - log.Printf("*** %v :: %v :: %v %v :: %v :: %v\n", uip, code, r.Method, r.URL, useragent, err.Error()) + reqLog.Printf("*** %v :: %v :: %v %v :: %v :: %v\n", uip, code, r.Method, r.URL, useragent, err.Error()) http.Error(w, fmt.Sprintf("Error %v: %v", code, err.Error()), code) } |