add selector, shortref logging in operations (#2605)

Some additional logging for debugging
This commit is contained in:
Keepers 2023-02-21 18:48:36 -07:00 committed by GitHub
parent f06f2f585a
commit 9dab7c0010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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()
}