Skip to content

Commit

Permalink
Merge pull request #278 from yordis/chore-fix-warning
Browse files Browse the repository at this point in the history
Fix Elixir `Logger.warn/2` warning deprecation message
  • Loading branch information
slashdotdash authored Oct 18, 2023
2 parents 2d5ada7 + b4a91fc commit 281eed3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/event_store/monitored_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ defmodule EventStore.MonitoredServer do
{:EXIT, ^pid, _reason} -> :ok
after
shutdown ->
Logger.warn(
Logger.warning(
"Monitored server #{inspect(module)} failed to terminate within #{shutdown}, killing it brutally"
)

Expand Down
4 changes: 2 additions & 2 deletions lib/event_store/storage/appender.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule EventStore.Storage.Appender do
end)
catch
{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to append events to stream #{inspect(stream_uuid)} due to: " <> inspect(error)
)

Expand Down Expand Up @@ -76,7 +76,7 @@ defmodule EventStore.Storage.Appender do
end)
catch
{:error, error} = reply ->
Logger.warn("Failed to link events to stream due to: #{inspect(error)}")
Logger.warning("Failed to link events to stream due to: #{inspect(error)}")

reply
end
Expand Down
4 changes: 2 additions & 2 deletions lib/event_store/storage/create_stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ defmodule EventStore.Storage.CreateStream do
{:error, %Postgrex.Error{postgres: %{code: :unique_violation}}},
stream_uuid
) do
Logger.warn("Failed to create stream #{inspect(stream_uuid)}, already exists")
Logger.warning("Failed to create stream #{inspect(stream_uuid)}, already exists")

{:error, :stream_exists}
end

defp handle_response({:error, error}, stream_uuid) do
Logger.warn("Failed to create stream #{inspect(stream_uuid)} due to: " <> inspect(error))
Logger.warning("Failed to create stream #{inspect(stream_uuid)} due to: " <> inspect(error))

{:error, error}
end
Expand Down
10 changes: 5 additions & 5 deletions lib/event_store/storage/delete_stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ defmodule EventStore.Storage.DeleteStream do
:ok

{:ok, %Postgrex.Result{num_rows: 0}} ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to soft delete stream #{inspect(stream_id)} due to: stream not found"
end)

{:error, :stream_not_found}

{:error, error} = reply ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to soft delete stream #{inspect(stream_id)} due to: " <> inspect(error)
end)

Expand All @@ -44,21 +44,21 @@ defmodule EventStore.Storage.DeleteStream do
:ok

{:ok, %Postgrex.Result{num_rows: 0}} ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to hard delete stream #{inspect(stream_id)} due to: stream not found"
end)

{:error, :stream_not_found}

{:error, %Postgrex.Error{postgres: %{code: :feature_not_supported}} = error} ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to hard delete stream #{inspect(stream_id)} due to: " <> inspect(error)
end)

{:error, :not_supported}

{:error, error} = reply ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to hard delete stream #{inspect(stream_id)} due to: " <> inspect(error)
end)

Expand Down
8 changes: 4 additions & 4 deletions lib/event_store/storage/reader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule EventStore.Storage.Reader do
end

defp failed_to_read(stream_id, reason) do
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to read events from stream id #{stream_id} due to: #{inspect(reason)}"
end)

Expand Down Expand Up @@ -133,17 +133,17 @@ defmodule EventStore.Storage.Reader do
{:ok, rows}

{:error, %Postgrex.Error{postgres: %{message: message}}} ->
Logger.warn("Failed to read events from stream due to: " <> inspect(message))
Logger.warning("Failed to read events from stream due to: " <> inspect(message))

{:error, message}

{:error, %DBConnection.ConnectionError{message: message}} ->
Logger.warn("Failed to read events from stream due to: " <> inspect(message))
Logger.warning("Failed to read events from stream due to: " <> inspect(message))

{:error, message}

{:error, error} = reply ->
Logger.warn("Failed to read events from stream due to: " <> inspect(error))
Logger.warning("Failed to read events from stream due to: " <> inspect(error))

reply
end
Expand Down
6 changes: 3 additions & 3 deletions lib/event_store/storage/snapshot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule EventStore.Storage.Snapshot do
{:ok, to_snapshot_from_row(row)}

{:error, error} = reply ->
Logger.warn(fn ->
Logger.warning(fn ->
"Failed to read snapshot for source \"#{source_uuid}\" due to: #{inspect(error)}"
end)

Expand All @@ -46,7 +46,7 @@ defmodule EventStore.Storage.Snapshot do
:ok

{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to record snapshot for source \"#{source_uuid}\" at version \"#{source_version}\" due to: " <>
inspect(error)
)
Expand All @@ -65,7 +65,7 @@ defmodule EventStore.Storage.Snapshot do
:ok

{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to delete snapshot for source \"#{source_uuid}\" due to: " <> inspect(error)
)

Expand Down
6 changes: 3 additions & 3 deletions lib/event_store/storage/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ defmodule EventStore.Storage.Subscription do
{:error, :subscription_already_exists}

{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to create stream create subscription on stream \"#{stream_uuid}\" named \"#{subscription_name}\" due to: " <>
inspect(error)
)
Expand All @@ -140,7 +140,7 @@ defmodule EventStore.Storage.Subscription do
:ok

{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to ack last seen event on stream \"#{stream_uuid}\" named \"#{subscription_name}\" due to: " <>
inspect(error)
)
Expand Down Expand Up @@ -171,7 +171,7 @@ defmodule EventStore.Storage.Subscription do
:ok

{:error, error} = reply ->
Logger.warn(
Logger.warning(
"Failed to delete subscription to stream \"#{stream_uuid}\" named \"#{subscription_name}\" due to: " <>
inspect(error)
)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule EventStore.Mixfile do
[
app: :eventstore,
version: @version,
elixir: "~> 1.10",
elixir: "~> 1.11",
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
description: description(),
Expand Down

0 comments on commit 281eed3

Please sign in to comment.