[#25] Refactoring and make fixes

closes #25
closes #33

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2020-10-24 16:09:22 +03:00
parent 4d605d1113
commit 256850b8fe
10 changed files with 125 additions and 64 deletions

View file

@ -137,7 +137,13 @@ func logErrorResponse(l *zap.Logger) mux.MiddlewareFunc {
if lw.statusCode >= http.StatusMultipleChoices {
l.Error("something went wrong",
zap.Int("status", lw.statusCode),
zap.String("method", mux.CurrentRoute(r).GetName()))
zap.String("method", mux.CurrentRoute(r).GetName()),
zap.String("description", http.StatusText(lw.statusCode)))
} else {
l.Info("call method",
zap.Int("status", lw.statusCode),
zap.String("method", mux.CurrentRoute(r).GetName()),
zap.String("description", http.StatusText(lw.statusCode)))
}
})
}
@ -162,7 +168,7 @@ func Attach(r *mux.Router, m MaxClients, h Handler, center *auth.Center, log *za
setRequestID,
// -- logging error requests
// logErrorResponse(log),
logErrorResponse(log),
)
// Attach user authentication for all S3 routes.