Skip to content

Commit

Permalink
fix: change remove logs to structured logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamir David authored and Tamir David committed Aug 14, 2024
1 parent 50d70b6 commit 19b2883
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions odiglet/pkg/instrumentation/fs/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func removeFilesInDir(hostDir string, filesToKeep map[string]struct{}) error {
shouldRecreateCFiles := ShouldRecreateAllCFiles()
log.Logger.V(0).Info(fmt.Sprintf("Removing files in directory: %s, shouldRecreateCFiles: %t", hostDir, shouldRecreateCFiles))
log.Logger.V(0).Info("Removing files in the host directory", "hostDir", hostDir, "shouldRecreateCFiles", shouldRecreateCFiles)

// Mark directories as protected if they contain a file that needs to be preserved.
// If C files should be recreated, skip marking any directories as protected.
Expand Down Expand Up @@ -38,14 +38,14 @@ func removeFilesInDir(hostDir string, filesToKeep map[string]struct{}) error {
// Skip removing any files listed in filesToKeepMap
if !info.IsDir() {
if _, found := filesToKeep[path]; found {
log.Logger.V(0).Info(fmt.Sprintf("Skipping protected file: %s", path))
log.Logger.V(0).Info("Skipping protected file", "file", path)
return nil
}
}

// Skip removing protected directories
if info.IsDir() && protectedDirs[path] {
log.Logger.V(0).Info(fmt.Sprintf("Skipping protected directory: %s", path))
log.Logger.V(0).Info("Skipping protected directory", "directory", path)
return nil
}

Expand Down

0 comments on commit 19b2883

Please sign in to comment.