From f7416dfe35374c7427a28c989a493c4d50228690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Mon, 27 Nov 2023 15:55:57 +0100 Subject: [PATCH] More logging --- pkg/storage/utils/metadata/cs3.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/storage/utils/metadata/cs3.go b/pkg/storage/utils/metadata/cs3.go index 4cf77651fda..67673aa70bb 100644 --- a/pkg/storage/utils/metadata/cs3.go +++ b/pkg/storage/utils/metadata/cs3.go @@ -35,6 +35,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net" + "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" @@ -134,11 +135,13 @@ func (cs3 *CS3) SimpleUpload(ctx context.Context, uploadpath string, content []b Path: uploadpath, Content: content, }) + appctx.GetLogger(ctx).Info().Msg("returning from cs3.SimpleUpload") return err } // Upload uploads a file to the metadata storage func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse, error) { + log := appctx.GetLogger(ctx).With().Logger() ctx, span := tracer.Start(ctx, "Upload") defer span.End() @@ -186,7 +189,9 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse, ifuReq.Opaque = utils.AppendPlainToOpaque(ifuReq.Opaque, net.HeaderUploadLength, strconv.FormatInt(int64(len(req.Content)), 10)) fmt.Println("client.InitiateFileUpload") + log.Info().Str("path", req.Path).Msg("cs3.Upload InitiateFileUpload...") res, err := client.InitiateFileUpload(ctx, ifuReq) + log.Info().Str("path", req.Path).Msg("cs3.Upload InitiateFileUpload done") fmt.Printf("client.InitiateFileUpload err=%v\n", err) if err != nil { return nil, err @@ -218,19 +223,28 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse, md, _ := metadata.FromOutgoingContext(ctx) httpReq.Header.Add(ctxpkg.TokenHeader, md.Get(ctxpkg.TokenHeader)[0]) fmt.Println("cs3.dataGatewayClient.Do") + log.Info().Str("path", req.Path).Msg("cs3.Upload dataGatewayClient.Do...") resp, err := cs3.dataGatewayClient.Do(httpReq) + log.Info().Str("path", req.Path).Interface("err", err).Interface("resp", resp).Msg("cs3.Upload dataGatewayClient.Do done") fmt.Printf("cs3.dataGatewayClient.Do err=%v\n", err) if err != nil { + log.Info().Str("path", req.Path).Msg("0") return nil, err } + log.Info().Str("path", req.Path).Msg("1") defer resp.Body.Close() + log.Info().Str("path", req.Path).Msg("2") if err := errtypes.NewErrtypeFromHTTPStatusCode(resp.StatusCode, httpReq.URL.Path); err != nil { + log.Info().Str("path", req.Path).Msg("2b") return nil, err } + log.Info().Str("path", req.Path).Msg("3") etag := resp.Header.Get("Etag") + log.Info().Str("path", req.Path).Msg("4") if ocEtag := resp.Header.Get("OC-ETag"); ocEtag != "" { etag = ocEtag } + log.Info().Str("path", req.Path).Err(err).Msg("returning from cs3.Upload") return &UploadResponse{ Etag: etag, }, nil