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

@ -33,10 +33,10 @@ func NewAuthenticator(authConfig *types.Auth) (*Authenticator, error) {
basicAuth := auth.NewBasicAuthenticator("traefik", authenticator.secretBasic)
authenticator.handler = negroni.HandlerFunc(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if username := basicAuth.CheckAuth(r); username == "" {
log.Debugf("Basic auth failed...")
log.Debug("Basic auth failed...")
basicAuth.RequireAuth(w, r)
} else {
log.Debugf("Basic auth success...")
log.Debug("Basic auth success...")
if authConfig.HeaderField != "" {
r.Header[authConfig.HeaderField] = []string{username}
}
@ -51,10 +51,10 @@ func NewAuthenticator(authConfig *types.Auth) (*Authenticator, error) {
digestAuth := auth.NewDigestAuthenticator("traefik", authenticator.secretDigest)
authenticator.handler = negroni.HandlerFunc(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if username, _ := digestAuth.CheckAuth(r); username == "" {
log.Debugf("Digest auth failed...")
log.Debug("Digest auth failed...")
digestAuth.RequireAuth(w, r)
} else {
log.Debugf("Digest auth success...")
log.Debug("Digest auth success...")
if authConfig.HeaderField != "" {
r.Header[authConfig.HeaderField] = []string{username}
}