Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 30, 2019 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/54459849a0405d4a8418f1649ba3343a to your computer and use it in GitHub Desktop.
Save parzibyte/54459849a0405d4a8418f1649ba3343a to your computer and use it in GitHub Desktop.
func middlewareLog(siguienteManejador http.Handler) http.Handler {
return http.HandlerFunc(
func(respuesta http.ResponseWriter, peticion *http.Request) {
log.Printf("Nueva petición. Método: %s. IP: %s. URL solicitada: %s\n",
peticion.Method, peticion.RemoteAddr, peticion.URL)
siguienteManejador.ServeHTTP(respuesta, peticion)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment