From 9dab7c0010b4bf1958945bbb42825531b7034176 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 21 Feb 2023 18:48:36 -0700 Subject: [PATCH] add selector, shortref logging in operations (#2605) Some additional logging for debugging --- src/internal/operations/backup.go | 1 + src/internal/operations/restore.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index e597e30da..e0fe73870 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -217,6 +217,7 @@ func (op *BackupOperation) do( backupID model.StableID, ) (*details.Builder, error) { reasons := selectorToReasons(op.Selectors) + logger.Ctx(ctx).With("selectors", op.Selectors).Info("backing up selection") // should always be 1, since backups are 1:1 with resourceOwners. opStats.resourceCount = 1 diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index 63565d852..1a65f406c 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -219,6 +219,7 @@ func (op *RestoreOperation) do( }) observe.Message(ctx, observe.Safe(fmt.Sprintf("Discovered %d items in backup %s to restore", len(paths), op.BackupID))) + logger.Ctx(ctx).With("selectors", op.Selectors).Info("restoring selection") kopiaComplete, closer := observe.MessageWithCompletion(ctx, observe.Safe("Enumerating items in repository")) defer closer() @@ -347,8 +348,9 @@ func formatDetailsForRestoration( } var ( - fdsPaths = fds.Paths() - paths = make([]path.Path, len(fdsPaths)) + fdsPaths = fds.Paths() + paths = make([]path.Path, len(fdsPaths)) + shortRefs = make([]string, len(fdsPaths)) ) for i := range fdsPaths { @@ -367,6 +369,7 @@ func formatDetailsForRestoration( } paths[i] = p + shortRefs[i] = p.ShortRef() } // TODO(meain): Move this to onedrive specific component, but as @@ -380,5 +383,7 @@ func formatDetailsForRestoration( return paths[i].String() < paths[j].String() }) + logger.Ctx(ctx).With("short_refs", shortRefs).Infof("found %d details entries to restore", len(shortRefs)) + return paths, errs.Err() }