Skip to content

Commit

Permalink
Log sync deletions to scanning logger (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulkar-msft authored Dec 23, 2022
1 parent 8f0103b commit 30958f8
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit 30958f8

Please sign in to comment.