@@ -33,7 +33,8 @@ const (
33
33
failedDeleting = "Failed deleting a scan"
34
34
failedCanceling = "Failed canceling a scan"
35
35
failedGettingAll = "Failed listing"
36
- thresholdLog = "Threshold %s: Limit = %d, Current = %v"
36
+ thresholdLog = "%s: Limit = %d, Current = %v"
37
+ thresholdMsgLog = "Threshold check finished with status %s : %s"
37
38
mbBytes = 1024.0 * 1024.0
38
39
resolverFilePerm = 0644
39
40
)
@@ -1023,20 +1024,28 @@ func applyThreshold(cmd *cobra.Command, resultsWrapper wrappers.ResultsWrapper,
1023
1024
}
1024
1025
1025
1026
var errorBuilder strings.Builder
1027
+ var messageBuilder strings.Builder
1026
1028
for key , thresholdLimit := range thresholdMap {
1027
1029
currentValue := summaryMap [key ]
1028
1030
failed := currentValue >= thresholdLimit
1029
1031
logMessage := fmt .Sprintf (thresholdLog , key , thresholdLimit , currentValue )
1030
- log . Println (logMessage )
1032
+ PrintIfVerbose (logMessage )
1031
1033
1032
1034
if failed {
1033
1035
errorBuilder .WriteString (fmt .Sprintf ("%s | " , logMessage ))
1036
+ } else {
1037
+ messageBuilder .WriteString (fmt .Sprintf ("%s | " , logMessage ))
1034
1038
}
1035
1039
}
1036
1040
1037
1041
errorMessage := errorBuilder .String ()
1038
1042
if errorMessage != "" {
1039
- return errors .Errorf ("%s" , errorMessage )
1043
+ return errors .Errorf (thresholdMsgLog , "Failed" , errorMessage )
1044
+ }
1045
+
1046
+ successMessage := messageBuilder .String ()
1047
+ if successMessage != "" {
1048
+ log .Printf (thresholdMsgLog , "Success" , successMessage )
1040
1049
}
1041
1050
1042
1051
return nil
0 commit comments