diff --git a/README.md b/README.md index 039dfc0..57eacce 100644 --- a/README.md +++ b/README.md @@ -95,18 +95,6 @@ Different credential providers may have other settings which you can use to change their behaviors. See the documentation for each provider for more details. -Error Logging -------------- - -If you prefer to not log errors as they happen (the default behavior), but accumulate -them for later, you can set erlang environment variable `log_errors_immediately` to -`false` as in this example: - -```erlang - {aws_credentials, [{log_errors_immediately, false}] - }, -``` - License and copyright --------------------- This project is licensed under the terms of the Apache 2 license. It is a diff --git a/src/aws_credentials.erl b/src/aws_credentials.erl index 2cf6003..e14afd1 100644 --- a/src/aws_credentials.erl +++ b/src/aws_credentials.erl @@ -33,7 +33,6 @@ , make_map/3 , make_map/4 , make_map/5 - , log_error/3 ]). -record(state, { credentials = undefined :: map() @@ -168,13 +167,6 @@ format_status(_, [_PDict, State]) -> %% Internal functions %%==================================================================== --spec log_error(String :: unicode:chardata(), Args :: [term()], logger:metadata()) -> ok. -log_error(String, Args, Metadata) -> - case application:get_env(aws_credentials, log_errors_immediately, true) of - true -> ?LOG_ERROR(String, Args, Metadata); - false -> ?LOG_INFO(String, Args, Metadata) - end. - -spec fetch_credentials(aws_credentials_provider:options()) -> {ok, credentials() | 'undefined', reference() | 'undefined'}. fetch_credentials(Options) -> diff --git a/src/aws_credentials_httpc.erl b/src/aws_credentials_httpc.erl index 97562a3..aa7c492 100644 --- a/src/aws_credentials_httpc.erl +++ b/src/aws_credentials_httpc.erl @@ -74,10 +74,10 @@ request(Method, URL, RequestHeaders, Tries, Remaining, Errs) -> Error -> NewRemaining = Remaining - 1, - String = "Error fetching URL (attempts left: ~p of ~p) ~p: ~p.", - Args = [NewRemaining, Tries, URL, Error], - Metadata = #{domain => [aws_credentials]}, - aws_credentials:log_error(String, Args, Metadata), + ?LOG_INFO("Error fetching URL (attempts left: " + "~p of ~p) ~p: ~p.", + [NewRemaining, Tries, URL, Error], + #{domain => [aws_credentials]}), timer:sleep((Tries - NewRemaining) * ?DELAY), request(Method, URL, RequestHeaders, Tries, NewRemaining, [ Error | Errs ]) end.