Skip to content

Commit

Permalink
Check elixir version for logger function
Browse files Browse the repository at this point in the history
`warning` is only available in 1.11. In earlier versions, it was called
`warn`.
  • Loading branch information
afontaine committed May 31, 2022
1 parent 7946b6c commit 8f607b8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/unleash/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,18 @@ defmodule Unleash.Metrics do
{:noreply, send_metrics(state)}
end

def handle_info({:mojito_response, _ref, message}, state) do
Logger.warning("Unexpected response from Mojito #{inspect(message, pretty: true)}")
{:noreply, send_metrics(state)}
if Version.match?(System.version(), ">= 1.11.0") do
def handle_info({:mojito_response, _ref, message}, state) do
Logger.warning("Unexpected response from Mojito #{inspect(message, pretty: true)}")

{:noreply, send_metrics(state)}
end
else
def handle_info({:mojito_response, _ref, message}, state) do
Logger.warn("Unexpected response from Mojito #{inspect(message, pretty: true)}")

{:noreply, send_metrics(state)}
end
end

if Config.test?() do
Expand Down

0 comments on commit 8f607b8

Please sign in to comment.