Skip to content

Instantly share code, notes, and snippets.

@gbbr
Last active July 12, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gbbr/935f26e50080ae99eedc822d8c273a89 to your computer and use it in GitHub Desktop.
Save gbbr/935f26e50080ae99eedc822d8c273a89 to your computer and use it in GitHub Desktop.
func withLogging(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
log.Printf("Logged connection from %s", r.RemoteAddr)
next.ServeHTTP(w, r)
}
}
func withTracing(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
log.Printf("Tracing request for %s", r.RequestURI)
next.ServeHTTP(w, r)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment