Skip to content

Find, verify, and analyze leaked credentials

[chore] - lower logging level (#2249)

ahrav28212c9a8222
diff --git a/pkg/cleantemp/cleantemp.go b/pkg/cleantemp/cleantemp.go
index 2c1bbf7e9..8ff4c7d98 100644
--- a/pkg/cleantemp/cleantemp.go
+++ b/pkg/cleantemp/cleantemp.go
@@ -63,6 +63,11 @@ func CleanTempArtifacts(ctx logContext.Context) error {
}
}
+ if len(pids) == 0 {
+ ctx.Logger().V(5).Info("No trufflehog processes were found")
+ return nil
+ }
+
tempDir := os.TempDir()
artifacts, err := os.ReadDir(tempDir)
if err != nil {
@@ -70,10 +75,6 @@ func CleanTempArtifacts(ctx logContext.Context) error {
}
for _, artifact := range artifacts {
- if len(pids) == 0 {
- ctx.Logger().Info("No trufflehog processes were found")
- continue
- }
if trufflehogRE.MatchString(artifact.Name()) {
// Mark these artifacts initially as ones that should be deleted.
shouldDelete := true
@@ -95,7 +96,7 @@ func CleanTempArtifacts(ctx logContext.Context) error {
err = os.Remove(artifactPath)
}
if err != nil {
- return fmt.Errorf("Error deleting temp artifact: %s", artifactPath)
+ return fmt.Errorf("error deleting temp artifact: %s", artifactPath)
}
ctx.Logger().Info("Deleted orphaned temp artifact", "artifact", artifactPath)