cmd/helloserver: don't log healthchecks
This commit is contained in:
parent
734e6ab036
commit
40e341db51
|
@ -30,5 +30,9 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
||||||
hn, _ := os.Hostname()
|
hn, _ := os.Hostname()
|
||||||
fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS)
|
fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS)
|
||||||
fmt.Fprintf(w, "Hit count: %d", hits.Inc())
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue