File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -508,17 +508,18 @@ def enforce_ex(self, *rvals):
508508 result = effect_to_bool (final_effect )
509509
510510 # Log request.
511-
512- req_str = "Request: "
513- req_str = req_str + ", " .join ([str (v ) for v in rvals ])
514-
515- req_str = req_str + " ---> %s" % result
516- if result :
517- self .logger .info (req_str )
518- else :
519- # leaving this in warning for now, if it's very noise this can be changed to info or debug,
520- # or change the log level
521- self .logger .warning (req_str )
511+ if (result and self .logger .isEnabledFor (logging .INFO )) or (
512+ not result and self .logger .isEnabledFor (logging .WARNING )
513+ ):
514+ req_str = "Request: "
515+ req_str = req_str + ", " .join ([str (v ) for v in rvals ])
516+ req_str = req_str + " ---> %s" % result
517+ if result :
518+ self .logger .info (req_str )
519+ else :
520+ # leaving this in warning for now, if it's very noise this can be changed to info or debug,
521+ # or change the log level
522+ self .logger .warning (req_str )
522523
523524 explain_rule = []
524525 if explain_index != - 1 and explain_index < policy_len :
You can’t perform that action at this time.
0 commit comments