diff --git a/app/daemon.go b/app/daemon.go index f17179b30b..f79bf24247 100644 --- a/app/daemon.go +++ b/app/daemon.go @@ -219,15 +219,7 @@ func startManager(c *cli.Context) error { server := api.NewServer(m, wsc) router := http.Handler(api.NewRouter(server)) - router = util.FilteredLoggingHandler(map[string]struct{}{ - "/v1/apiversions": {}, - "/v1/schemas": {}, - "/v1/settings": {}, - "/v1/volumes": {}, - "/v1/nodes": {}, - "/v1/engineimages": {}, - "/v1/events": {}, - }, os.Stdout, router) + router = util.FilteredLoggingHandler(os.Stdout, router) router = handlers.ProxyHeaders(router) listen := types.GetAPIServerAddressFromIP(currentIP) diff --git a/util/util.go b/util/util.go index 693ba7f8f9..411e02a012 100644 --- a/util/util.go +++ b/util/util.go @@ -456,15 +456,13 @@ func RunAsync(wg *sync.WaitGroup, f func()) { } type filteredLoggingHandler struct { - filteredPaths map[string]struct{} handler http.Handler loggingHandler http.Handler } -func FilteredLoggingHandler(filteredPaths map[string]struct{}, writer io.Writer, router http.Handler) http.Handler { +func FilteredLoggingHandler(writer io.Writer, router http.Handler) http.Handler { return filteredLoggingHandler{ - filteredPaths: filteredPaths, handler: router, loggingHandler: handlers.CombinedLoggingHandler(writer, router), } @@ -473,7 +471,7 @@ func FilteredLoggingHandler(filteredPaths map[string]struct{}, writer io.Writer, func (h filteredLoggingHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { switch req.Method { case "GET": - if _, exists := h.filteredPaths[req.URL.Path]; exists { + if logrus.GetLevel() < logrus.DebugLevel { h.handler.ServeHTTP(w, req) return }