From a268613659f2688b7e89331e7773768287a3ab07 Mon Sep 17 00:00:00 2001 From: Sanskarzz Date: Wed, 17 Apr 2024 15:59:58 +0530 Subject: [PATCH] Used log.printf instead of fmt.printf Signed-off-by: Sanskarzz --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 4f625c9a..2d248500 100644 --- a/main.go +++ b/main.go @@ -95,7 +95,7 @@ func (s *extAuthzServerV3) Check(ctx context.Context, req *authv3.CheckRequest) Policies: policies, }) - fmt.Printf("Request is initialized in kyvernojson engine .\n") + log.Printf("Request is initialized in kyvernojson engine .\n") var violations []error @@ -104,16 +104,16 @@ func (s *extAuthzServerV3) Check(ctx context.Context, req *authv3.CheckRequest) if rule.Error != nil { // If there is an error, add it to the violations error array violations = append(violations, fmt.Errorf("%v", rule.Error)) - fmt.Printf("Request violation: %v\n", rule.Error) + log.Printf("Request violation: %v\n", rule.Error.Error()) } else if len(rule.Violations) != 0 { // If there are violations, add them to the violations error array for _, violation := range rule.Violations { violations = append(violations, fmt.Errorf("%v", violation)) } - fmt.Printf("Request violation: %v\n", violations) + log.Printf("Request violation: %v\n", rule.Violations.Error()) } else { // If the rule passed, log it but continue to the next rule/policy - fmt.Printf("Request passed the %v policy rule.\n", rule.Rule.Name) + log.Printf("Request passed the %v policy rule.\n", rule.Rule.Name) } } }