mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-19 06:00:40 -04:00
corrections from code review
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
RequestIDString = "request"
|
||||
RequestIDString = "request-id"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -17,7 +17,7 @@ func Logger(logger log.Logger) func(http.Handler) http.Handler {
|
||||
next.ServeHTTP(wrap, r)
|
||||
|
||||
logger.Debug().
|
||||
Str("request", r.Header.Get("X-Request-ID")).
|
||||
Str(log.RequestIDString, r.Header.Get("X-Request-ID")).
|
||||
Str("proto", r.Proto).
|
||||
Str("method", r.Method).
|
||||
Int("status", wrap.Status()).
|
||||
|
||||
@@ -399,7 +399,7 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
logger.Debug().Interface("request", updateSpaceRequest).Msg("calling update space on backend")
|
||||
logger.Debug().Interface("payload", updateSpaceRequest).Msg("calling update space on backend")
|
||||
resp, err := client.UpdateStorageSpace(r.Context(), updateSpaceRequest)
|
||||
if err != nil {
|
||||
logger.Error().Err(err).Msg("could not update drive: transport error")
|
||||
|
||||
@@ -19,7 +19,7 @@ func AccessLog(logger log.Logger) func(http.Handler) http.Handler {
|
||||
|
||||
logger.Info().
|
||||
Str("proto", r.Proto).
|
||||
Str("request", chimiddleware.GetReqID(r.Context())).
|
||||
Str(log.RequestIDString, chimiddleware.GetReqID(r.Context())).
|
||||
Str("remote-addr", r.RemoteAddr).
|
||||
Str("method", r.Method).
|
||||
Int("status", wrap.Status()).
|
||||
|
||||
@@ -78,7 +78,7 @@ func (s Thumbnails) GetThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
thumbnail, err := s.manager.GetThumbnail(key)
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
logger.Debug().
|
||||
Err(err).
|
||||
Str("key", key).
|
||||
Msg("could not get the thumbnail")
|
||||
|
||||
@@ -243,7 +243,7 @@ func (g Webdav) SpacesThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
renderError(w, r, errInternalError(err.Error()))
|
||||
}
|
||||
logger.Error().Err(err).Msg("could not get thumbnail")
|
||||
logger.Debug().Err(err).Msg("could not get thumbnail")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ func (g Webdav) PublicThumbnailHead(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
renderError(w, r, errInternalError(err.Error()))
|
||||
}
|
||||
logger.Error().Err(err).Msg("could not get thumbnail")
|
||||
logger.Debug().Err(err).Msg("could not get thumbnail")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ func (g Webdav) sendThumbnailResponse(rsp *thumbnailssvc.GetThumbnailResponse, w
|
||||
dlReq, err := http.NewRequest(http.MethodGet, rsp.DataEndpoint, http.NoBody)
|
||||
if err != nil {
|
||||
renderError(w, r, errInternalError(err.Error()))
|
||||
logger.Error().Err(err).Msg("could not download thumbnail")
|
||||
logger.Error().Err(err).Msg("could not create download thumbnail request")
|
||||
return
|
||||
}
|
||||
dlReq.Header.Set("Transfer-Token", rsp.TransferToken)
|
||||
@@ -431,13 +431,13 @@ func (g Webdav) sendThumbnailResponse(rsp *thumbnailssvc.GetThumbnailResponse, w
|
||||
dlRsp, err := client.Do(dlReq)
|
||||
if err != nil {
|
||||
renderError(w, r, errInternalError(err.Error()))
|
||||
logger.Error().Err(err).Msg("could not download thumbnail")
|
||||
logger.Error().Err(err).Msg("could not download thumbnail: transport error")
|
||||
return
|
||||
}
|
||||
defer dlRsp.Body.Close()
|
||||
|
||||
if dlRsp.StatusCode != http.StatusOK {
|
||||
logger.Error().
|
||||
logger.Debug().
|
||||
Str("transfer_token", rsp.TransferToken).
|
||||
Str("data_endpoint", rsp.DataEndpoint).
|
||||
Str("response_status", dlRsp.Status).
|
||||
|
||||
Reference in New Issue
Block a user