From 07b2d7fbd7f8ef5473c2438c560fffc8bdadf913 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Wed, 4 Dec 2024 10:00:27 +0600 Subject: [PATCH] fix(misconf): use log instead of fmt for logging (#8033) Signed-off-by: nikpivkin --- .../scanners/cloudformation/parser/property_conversion.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/iac/scanners/cloudformation/parser/property_conversion.go b/pkg/iac/scanners/cloudformation/parser/property_conversion.go index d1ef23d396f2..95f6a48bf380 100644 --- a/pkg/iac/scanners/cloudformation/parser/property_conversion.go +++ b/pkg/iac/scanners/cloudformation/parser/property_conversion.go @@ -2,11 +2,11 @@ package parser import ( "fmt" - "os" "strconv" "strings" "github.com/aquasecurity/trivy/pkg/iac/scanners/cloudformation/cftypes" + "github.com/aquasecurity/trivy/pkg/log" ) func (p *Property) IsConvertableTo(conversionType cftypes.CfType) bool { @@ -75,7 +75,11 @@ func (p *Property) ConvertTo(conversionType cftypes.CfType) *Property { } if !p.IsConvertableTo(conversionType) { - _, _ = fmt.Fprintf(os.Stderr, "property of type %s cannot be converted to %s\n", p.Type(), conversionType) + log.Debug("Failed to convert property", + log.String("from", string(p.Type())), + log.String("to", string(conversionType)), + log.Any("range", p.Range().String()), + ) return p } switch conversionType {