Skip to content

Commit

Permalink
Replace deprecated Logger.warn/1 with Logger.warning/2
Browse files Browse the repository at this point in the history
  • Loading branch information
StanczakDominik committed Jun 2, 2024
1 parent fc4a5b0 commit f04d0af
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/teiserver/account/servers/client_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ defmodule Teiserver.Account.ClientServer do
end

def handle_cast({:merge_update_client, partial_client}, state) do
Logger.warn(":merge_update_client is still being used, instead use :update_values")
Logger.warning(":merge_update_client is still being used, instead use :update_values")
new_client = Map.merge(state.client, partial_client)

PubSub.broadcast(
Expand Down
20 changes: 10 additions & 10 deletions lib/teiserver/battle/servers/match_monitor_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ defmodule Teiserver.Battle.MatchMonitorServer do
Telemetry.log_simple_match_event(userid, match_id, event_type_name, game_time)
Logger.info("match-event: Stored <#{username}> <#{event_type_name}> <#{game_time}> userid #{userid} match_id #{match_id}")
else
Logger.warn("match-event: Cannot get match_id of userid of #{username}")
Logger.warning("match-event: Cannot get match_id of userid of #{username}")
end
else
Logger.warn("match-event: Cannot get userid of #{username} or is not a bot")
Logger.warning("match-event: Cannot get userid of #{username} or is not a bot")
end

_ ->
Expand Down Expand Up @@ -242,7 +242,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do
end

_ ->
Logger.warn("match-chat nomatch from: #{from_id}: match-chat #{data}")
Logger.warning("match-chat nomatch from: #{from_id}: match-chat #{data}")
end

{:noreply, state}
Expand Down Expand Up @@ -288,7 +288,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do
end

_ ->
Logger.warn("match-chat-name nomatch from: #{from_id}: match-chat [[#{data}]]")
Logger.warning("match-chat-name nomatch from: #{from_id}: match-chat [[#{data}]]")
end

{:noreply, state}
Expand All @@ -311,23 +311,23 @@ defmodule Teiserver.Battle.MatchMonitorServer do
handle_json_msg(data, from_id)

_ ->
Logger.warn("AHM DM no catch, no json-decode - '#{contents_string}'")
Logger.warning("AHM DM no catch, no json-decode - '#{contents_string}'")
end

_ ->
Logger.warn("AHM DM no catch, no decompress - '#{compressed_contents}'")
Logger.warning("AHM DM no catch, no decompress - '#{compressed_contents}'")
end

_ ->
Logger.warn("AHM DM no catch, no base64 - '#{message}'")
Logger.warning("AHM DM no catch, no base64 - '#{message}'")
end

{:noreply, state}
end

# Catchall handle_info
def handle_info(msg, state) do
Logger.warn(
Logger.warning(
"Match monitor Server handle_info error. No handler for msg of #{Kernel.inspect(msg)}"
)

Expand All @@ -337,7 +337,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do
defp handle_json_msg(%{"username" => username, "GPU" => _} = contents, from_id) do
case CacheUser.get_user_by_name(username) do
nil ->
Logger.warn("No username on handle_json_msg: #{username} - #{Kernel.inspect(contents)}")
Logger.warning("No username on handle_json_msg: #{username} - #{Kernel.inspect(contents)}")

:ok

Expand Down Expand Up @@ -367,7 +367,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do
end

defp handle_json_msg(contents, _from_id) do
Logger.warn("No catch on handle_json_msg: #{Kernel.inspect(contents)}")
Logger.warning("No catch on handle_json_msg: #{Kernel.inspect(contents)}")
:ok
end

Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/benchmark/stats_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Avg ping: #{round(average_ping * 100) / 100}ms, Pings: #{Enum.count(state.pings)
port: port
})

Logger.warn("Starting stats")
Logger.warning("Starting stats")
:timer.send_interval(@registration_interval, self(), :register)
send(self(), :register)

Expand Down
4 changes: 2 additions & 2 deletions lib/teiserver/bridge/message_commands.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Teiserver.Bridge.MessageCommands do
content: "$" <> content,
attachments: []
}) do
Logger.warn("1")
Logger.warning("1")

[cmd | remaining] = String.split(content, " ")
remaining = Enum.join(remaining, " ")
Expand Down Expand Up @@ -45,7 +45,7 @@ defmodule Teiserver.Bridge.MessageCommands do
end

def handle(_msg) do
# Logger.warn("2")
# Logger.warning("2")
# IO.inspect msg

:ok
Expand Down
4 changes: 2 additions & 2 deletions lib/teiserver/coordinator/consul_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ defmodule Teiserver.Coordinator.ConsulServer do
# if existing.ready == false and new_client.ready == true and existing.unready_at != nil do
# time_elapsed = System.system_time(:millisecond) - existing.unready_at
# if time_elapsed < 1000 do
# Logger.warn("Ready up in #{time_elapsed}ms by #{existing.userid}/#{existing.name} using #{existing.lobby_client}")
# Logger.warning("Ready up in #{time_elapsed}ms by #{existing.userid}/#{existing.name} using #{existing.lobby_client}")
# end
# end

Expand Down Expand Up @@ -695,7 +695,7 @@ defmodule Teiserver.Coordinator.ConsulServer do

if player_count > 4 do
if user.hw_hash == nil do
Logger.warn("hw hash block for #{Account.get_username(userid)}")
Logger.warning("hw hash block for #{Account.get_username(userid)}")
%{new_client | player: false}
else
new_client
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/helpers/oban_logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Teiserver.Helper.ObanLogger do
require Logger

def handle_event([:oban, :job, :start], _measure, _meta, _) do
# Logger.warn("[Oban] :started #{meta.worker} at #{measure.system_time}")
# Logger.warning("[Oban] :started #{meta.worker} at #{measure.system_time}")
end

def handle_event([:oban, :job, :exception], _measure, meta, _) do
Expand Down
6 changes: 3 additions & 3 deletions lib/teiserver/lobby/libs/lobby_lib.ex
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ defmodule Teiserver.Lobby.LobbyLib do

@spec update_lobby(T.lobby(), nil | atom, any) :: T.lobby()
def update_lobby(%{id: lobby_id} = lobby, nil, :silent) do
Logger.warn("update_lobby is still being called for :silent")
Logger.warning("update_lobby is still being called for :silent")
cast_lobby(lobby_id, {:update_lobby, lobby})

lobby
end

def update_lobby(%{id: lobby_id} = lobby, nil, reason) do
Logger.warn("update_lobby (no data) is still being called, reason: #{reason}")
Logger.warning("update_lobby (no data) is still being called, reason: #{reason}")
cast_lobby(lobby_id, {:update_lobby, lobby})

PubSub.broadcast(
Expand All @@ -224,7 +224,7 @@ defmodule Teiserver.Lobby.LobbyLib do
end

def update_lobby(%{id: lobby_id} = lobby, data, reason) do
Logger.warn("update_lobby (with data) is still being called, reason: #{reason}")
Logger.warning("update_lobby (with data) is still being called, reason: #{reason}")
cast_lobby(lobby_id, {:update_lobby, lobby})

if Enum.member?([:update_battle_info], reason) do
Expand Down
4 changes: 2 additions & 2 deletions lib/teiserver/protocols/spring/spring_in.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1408,11 +1408,11 @@ defmodule Teiserver.Protocols.SpringIn do

cond do
Enum.count(status_timestamps) > 10 ->
Logger.warn("status_flood_protection:10 - #{state.username}/#{state.userid}")
Logger.warning("status_flood_protection:10 - #{state.username}/#{state.userid}")
{true, %{state | status_timestamps: status_timestamps}}

Enum.count(recent_timestamps) > 3 ->
Logger.warn("status_flood_protection:3 - #{state.username}/#{state.userid}")
Logger.warning("status_flood_protection:3 - #{state.username}/#{state.userid}")
{true, %{state | status_timestamps: status_timestamps}}

true ->
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/protocols/spring/spring_out.ex
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ defmodule Teiserver.Protocols.SpringOut do
# I've made the mistake of forgetting it and wondering
# why stuff wasn't working so it's staying here
if not String.ends_with?(msg, "\n") do
Logger.warn("Attempting to send message without newline at the end - #{msg}")
Logger.warning("Attempting to send message without newline at the end - #{msg}")
end

msg =
Expand Down
4 changes: 2 additions & 2 deletions lib/teiserver/protocols/tachyon_lib.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ defmodule Teiserver.Protocols.TachyonLib do
:error ->
# Previously got an error with data 'OK cmd=TACHYON' which suggests
# it was still in Spring mode
Logger.warn("Base64 error, given '#{data}'")
Logger.warning("Base64 error, given '#{data}'")
{:error, :base64_decode}

{:error, :gzip_decompress} ->
Logger.warn("Gzip error, given '#{data}'")
Logger.warning("Gzip error, given '#{data}'")
{:error, :gzip_decompress}

{:error, %Jason.DecodeError{}} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/protocols/tachyon_v1/communication_out.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Teiserver.Protocols.Tachyon.V1.CommunicationOut do
###########
# Direct messages
def do_reply(:direct_message, {sender_id, msg}) do
Logger.warn(
Logger.warning(
"Using :direct_message instead of :received_direct_message in V1.CommunicationOut"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/protocols/tachyon_v1/tachyon_out.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defmodule Teiserver.Protocols.Tachyon.V1.TachyonOut do
LobbyOut.do_reply(reply_cmd, data)

:battle ->
Logger.warn("Tachyon :battle namespace message #{reply_cmd}")
Logger.warning("Tachyon :battle namespace message #{reply_cmd}")
LobbyOut.do_reply(reply_cmd, data)

:matchmaking ->
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver_web/live/battles/lobbies/chat.ex
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ defmodule TeiserverWeb.Battle.LobbyLive.Chat do
end

def handle_info(msg, socket) do
Logger.warn("No handler in #{__MODULE__} for message #{Kernel.inspect(msg)}")
Logger.warning("No handler in #{__MODULE__} for message #{Kernel.inspect(msg)}")
{:noreply, socket}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver_web/live/queues/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ defmodule TeiserverWeb.Matchmaking.QueueLive.Index do
} = data,
socket
) do
Logger.warn("index.ex Match ready")
Logger.warning("index.ex Match ready")

{:noreply,
socket
Expand Down

0 comments on commit f04d0af

Please sign in to comment.