refactor: Logs & errors review.

- log & error: remove format if not necessary, add if necessary.
- add constants for k8s annotations.
- fix typos
This commit is contained in:
Fernandez Ludovic 2017-05-26 17:03:14 +02:00 committed by Ludovic Fernandez
parent 994e135368
commit cbccdd51c5
26 changed files with 125 additions and 128 deletions

View file

@ -91,7 +91,7 @@ func NewServer(globalConfiguration GlobalConfiguration) *Server {
var err error
server.accessLoggerMiddleware, err = accesslog.NewLogHandler(globalConfiguration.AccessLogsFile)
if err != nil {
log.Warn("Unable to create log handler: %s", err)
log.Warnf("Unable to create log handler: %s", err)
}
return server
}
@ -147,7 +147,7 @@ func (server *Server) Close() {
if ctx.Err() == context.Canceled {
return
} else if ctx.Err() == context.DeadlineExceeded {
log.Warnf("Timeout while stopping traefik, killing instance ✝")
log.Warn("Timeout while stopping traefik, killing instance ✝")
os.Exit(1)
}
}(ctx)
@ -736,6 +736,7 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
negroni.Use(metricsMiddlewareBackend)
}
}
ipWhitelistMiddleware, err := configureIPWhitelistMiddleware(frontend.WhitelistSourceRange)
if err != nil {
log.Fatalf("Error creating IP Whitelister: %s", err)
@ -761,6 +762,7 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
negroni.Use(authMiddleware)
}
}
if configuration.Backends[frontend.Backend].CircuitBreaker != nil {
log.Debugf("Creating circuit breaker %s", configuration.Backends[frontend.Backend].CircuitBreaker.Expression)
cbreaker, err := middlewares.NewCircuitBreaker(lb, configuration.Backends[frontend.Backend].CircuitBreaker.Expression, cbreaker.Logger(oxyLogger))