cmd/helloserver: don't log healthchecks

This commit is contained in:
Cadey Ratio 2017-04-05 22:35:33 -07:00
parent 734e6ab036
commit 40e341db51
1 changed files with 5 additions and 1 deletions

View File

@ -30,5 +30,9 @@ func handle(w http.ResponseWriter, r *http.Request) {
hn, _ := os.Hostname()
fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS)
fmt.Fprintf(w, "Hit count: %d", hits.Inc())
log.Printf("Hit from %s: %s", r.Header.Get("X-Remote-Ip"), r.RequestURI)
ip := r.Header.Get("X-Remote-Ip")
if ip != "" {
log.Printf("Hit from %s: %s", ip, r.RequestURI)
}
}