Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log sync deletions to scanning logger #2000

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions cmd/syncProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ func (d *interactiveDeleteProcessor) removeImmediately(object StoredObject) (err

err = d.deleter(object)
if err != nil {
glcm.Info(fmt.Sprintf("error %s deleting the object %s", err.Error(), object.relativePath))
msg := fmt.Sprintf("error %s deleting the object %s", err.Error(), object.relativePath)
glcm.Info(msg)
if azcopyScanningLogger != nil {
azcopyScanningLogger.Log(pipeline.LogInfo, msg)
}
}

if d.incrementDeletionCount != nil {
Expand Down Expand Up @@ -241,7 +245,11 @@ func shouldSyncRemoveFolders() bool {

func (l *localFileDeleter) deleteFile(object StoredObject) error {
if object.entityType == common.EEntityType.File() {
glcm.Info("Deleting extra file: " + object.relativePath)
msg := "Deleting extra file: " + object.relativePath
glcm.Info(msg)
if azcopyScanningLogger != nil {
azcopyScanningLogger.Log(pipeline.LogInfo, msg)
}
return os.Remove(common.GenerateFullPath(l.rootPath, object.relativePath))
}
if shouldSyncRemoveFolders() {
Expand Down Expand Up @@ -286,7 +294,11 @@ func newRemoteResourceDeleter(rawRootURL *url.URL, p pipeline.Pipeline, ctx cont
func (b *remoteResourceDeleter) delete(object StoredObject) error {
if object.entityType == common.EEntityType.File() {
// TODO: use b.targetLocation.String() in the next line, instead of "object", if we can make it come out as string
glcm.Info("Deleting extra object: " + object.relativePath)
msg := "Deleting extra object: " + object.relativePath
glcm.Info(msg)
if azcopyScanningLogger != nil {
azcopyScanningLogger.Log(pipeline.LogInfo, msg)
}
switch b.targetLocation {
case common.ELocation.Blob():
blobURLParts := azblob.NewBlobURLParts(*b.rootURL)
Expand Down