Skip to content

Commit

Permalink
Used log.printf instead of fmt.printf
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskarzz <[email protected]>
  • Loading branch information
Sanskarzz committed Apr 17, 2024
1 parent 65d9c05 commit a268613
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit a268613

Please sign in to comment.