cd054983ff
The Logging boolean was unconditionally set to true and ignored in all locations, except for enabling the debugging middleware, which was also gated by the active logrus logging level. While it could make sense to have a Loglevel option configured on the API server, we don't have this currently, and to make that actually useful, that config would need to be tollerated by all locations that produce logs (which isn't the case either). Looking at the history of this option; a boolean to disable logging was originally added in commitc423a790d6
, which hard-coded it to "disabled" in a test, and "enabled" for the API server outside of tests (before that commit, logging was always enabled).02ddaad5d9
and5c42b2b512
changed the hard-coded values to be configurable through a `Logging` env-var (env- vars were used _internally_ at the time to pass on options), which later became a configuration struct ina0bf80fe03
. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
24 lines
716 B
Go
24 lines
716 B
Go
package server // import "github.com/docker/docker/api/server"
|
|
|
|
import (
|
|
"github.com/docker/docker/api/server/httputils"
|
|
"github.com/docker/docker/api/server/middleware"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// handlerWithGlobalMiddlewares wraps the handler function for a request with
|
|
// the server's global middlewares. The order of the middlewares is backwards,
|
|
// meaning that the first in the list will be evaluated last.
|
|
func (s *Server) handlerWithGlobalMiddlewares(handler httputils.APIFunc) httputils.APIFunc {
|
|
next := handler
|
|
|
|
for _, m := range s.middlewares {
|
|
next = m.WrapHandler(next)
|
|
}
|
|
|
|
if logrus.GetLevel() == logrus.DebugLevel {
|
|
next = middleware.DebugRequestMiddleware(next)
|
|
}
|
|
|
|
return next
|
|
}
|