func InjectLogger()

in internal/middleware/logger/logger.go [39:50]


func InjectLogger(next http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		loggerObj := logger.WithFields(logrus.Fields{
			"client-addr": r.RemoteAddr,
		})

		// Add the logger to the request's context for easy access in handlers
		ctx := context.WithValue(r.Context(), contextKey, loggerObj)
		r = r.WithContext(ctx)
		next(w, r)
	}
}