Namespace is middleware that sets the namespace.
(value string)
| 22 | |
| 23 | // Namespace is middleware that sets the namespace. |
| 24 | func Namespace(value string) MiddlewareFunc { |
| 25 | return func(next http.Handler) http.Handler { |
| 26 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 27 | next.ServeHTTP(w, r.WithContext(log.NewContextWithField(r.Context(), "namespace", value))) |
| 28 | }) |
| 29 | } |
| 30 | } |