Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLATFORM-559]: [BridgeEx] Reconsider usage of get_env for log_options #62

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

2 changes: 0 additions & 2 deletions lib/graphql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ defmodule BridgeEx.Graphql do
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
defmacro __using__(opts) when is_list(opts) do
quote do
require Logger

alias BridgeEx.Auth0AuthorizationProvider
alias BridgeEx.Graphql.Client
alias BridgeEx.Graphql.Formatter.SnakeCase
Expand Down
14 changes: 11 additions & 3 deletions lib/graphql/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,17 @@ defmodule BridgeEx.Graphql.Client do
end

defp log_options do
Application.get_env(:bridge_ex, :log_options,
log_query_on_error: false,
log_response_on_error: false
global_log_options = Application.get_env(:bridge_ex, :log_options, [])

if length(global_log_options) != 0 do
Logger.warning(
"Global log_options is deprecated and will be removed in the future, please use the local ones"
)
end

Keyword.merge(
[log_query_on_error: false, log_response_on_error: false],
global_log_options
)
end

Expand Down