From 086b2b8607e8cd39ae2b14584988e4e5ba84e57b Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Fri, 22 Nov 2024 22:40:45 +0530 Subject: [PATCH] add logs --- .../0chain.net/blobbercore/allocation/file_changer_upload.go | 3 +++ code/go/0chain.net/blobbercore/handler/file_command_upload.go | 1 + code/go/0chain.net/blobbercore/handler/storage_handler.go | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/code/go/0chain.net/blobbercore/allocation/file_changer_upload.go b/code/go/0chain.net/blobbercore/allocation/file_changer_upload.go index 581883784..252d43fef 100644 --- a/code/go/0chain.net/blobbercore/allocation/file_changer_upload.go +++ b/code/go/0chain.net/blobbercore/allocation/file_changer_upload.go @@ -15,6 +15,7 @@ import ( "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" "github.com/0chain/common/core/util/wmpt" + "go.uber.org/zap" "gorm.io/gorm" "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" @@ -22,6 +23,7 @@ import ( "github.com/0chain/blobber/code/go/0chain.net/core/common" "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" ) // swagger:model UploadFileChanger @@ -209,6 +211,7 @@ func (nf *UploadFileChanger) ApplyChangeV2(ctx context.Context, allocationRoot, if err != nil { return 0, err } + logging.Logger.Info("newFile", zap.Int("encVersion", nf.EncryptionVersion), zap.String("allocationID", nf.AllocationID), zap.String("path", nf.Path)) collector.CreateRefRecord(newFile) numFiles.Add(1) decodedKey, _ := hex.DecodeString(newFile.LookupHash) diff --git a/code/go/0chain.net/blobbercore/handler/file_command_upload.go b/code/go/0chain.net/blobbercore/handler/file_command_upload.go index 3969f5fda..3a5718ed4 100644 --- a/code/go/0chain.net/blobbercore/handler/file_command_upload.go +++ b/code/go/0chain.net/blobbercore/handler/file_command_upload.go @@ -119,6 +119,7 @@ func (cmd *UploadFileCommand) IsValidated(ctx context.Context, req *http.Request } cmd.contentFile = origfile cmd.fileChanger = fileChanger + logging.Logger.Info("UploadFileCommand.IsValidated", zap.Int("encryption_version", fileChanger.EncryptionVersion), zap.String("allocationID", fileChanger.AllocationID), zap.String("path", fileChanger.Path)) return nil } diff --git a/code/go/0chain.net/blobbercore/handler/storage_handler.go b/code/go/0chain.net/blobbercore/handler/storage_handler.go index 885c1e617..c7a20d669 100644 --- a/code/go/0chain.net/blobbercore/handler/storage_handler.go +++ b/code/go/0chain.net/blobbercore/handler/storage_handler.go @@ -157,7 +157,9 @@ func (fsh *StorageHandler) GetFileMeta(ctx context.Context, r *http.Request) (in } result := fileref.GetListingData(ctx) - + if fileref.Type == reference.FILE { + logging.Logger.Info("get_file_meta", zap.Int("encryption_version", fileref.EncryptionVersion), zap.Any("result_version", result["encryption_version"]), zap.String("allocation_id", allocationID), zap.String("path", fileref.Path)) + } if !isOwner && !isRepairer { var authTokenString = r.FormValue("auth_token")