9func (s *Server) loggingHandler(next http.Handler) http.Handler {
10 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
17 lrw := &loggingResponseWriter{ResponseWriter: w, statusCode: http.StatusOK}
18 s.logger.Debug("HTTP request",
19 slog.String("method", r.Method),
20 slog.String("path", r.URL.Path),
21 slog.String("remote_addr", r.RemoteAddr),
22 slog.String("user_agent", r.UserAgent()),
25 next.ServeHTTP(lrw, r)
26 duration := time.Since(start)
28 s.logger.Debug("HTTP response",
29 slog.String("method", r.Method),
30 slog.String("path", r.URL.Path),
31 slog.Int("status", lrw.statusCode),
32 slog.Duration("duration", duration),
33 slog.String("remote_addr", r.RemoteAddr),
34 slog.String("user_agent", r.UserAgent()),
39type loggingResponseWriter struct {
44func (lrw *loggingResponseWriter) WriteHeader(code int) {
46 lrw.ResponseWriter.WriteHeader(code)
49func (lrw *loggingResponseWriter) Unwrap() http.ResponseWriter {
50 return lrw.ResponseWriter
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list