Skip to content

Commit

Permalink
improvement: don't log field policies unless logging successful polic…
Browse files Browse the repository at this point in the history
…y breakdowns
  • Loading branch information
zachdaniel committed Dec 10, 2024
1 parent 46c06ef commit d04e804
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ash/error/forbidden/policy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ defmodule Ash.Error.Forbidden.Policy do
exception =
super(Keyword.put(opts, :policy_breakdown?, Ash.Policy.Info.show_policy_breakdowns?()))

case Ash.Policy.Info.log_policy_breakdowns() do
log_level =
if exception.for_fields do
Ash.Policy.Info.log_successful_policy_breakdowns()
else
Ash.Policy.Info.log_policy_breakdowns()
end

case log_level do
nil ->
:ok

Expand Down

0 comments on commit d04e804

Please sign in to comment.