Created
January 20, 2015 23:40
-
-
Save webdev/5f0ddd0d29ea1eca806a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type loggingResponseWriter interface {¬ | |
| + ▸ http.ResponseWriter¬ | |
| + ▸ Status() int¬ | |
| + ▸ Size() int¬ | |
| + }¬ | |
| + ¬ | |
| func Log(handler http.Handler) http.Handler {¬ | |
| ▸ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {¬ | |
| ~ ¬ | |
| ~ ▸ ▸ logger := &loggingResponseWriter{w: w}¬ | |
| + ¬ | |
| + ▸ ▸ handler.ServeHTTP(logger, r)¬ | |
| + ¬ | |
| + ▸ ▸ log.Printf("%s %s %s %s\n", r.RemoteAddr, r.Method, r.URL, logger.Status())¬ | |
| ▸ })¬ | |
| }¬ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment