Skip to content

Commit

Permalink
chore: replace calls to Logger.warn with Logger.warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth committed Oct 4, 2023
1 parent fe5e61e commit 83d8f34
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/logflare/admin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Logflare.Admin do
def shutdown(node \\ Node.self(), delay \\ 5000) when is_atom(node) do
task =
Task.async(fn ->
Logger.warn("Node shutdown initialized, shutting down in #{delay}ms. node=#{node}")
Logger.warning("Node shutdown initialized, shutting down in #{delay}ms. node=#{node}")
Process.sleep(delay)

:rpc.eval_everywhere([node], System, :stop, [])
Expand Down
6 changes: 3 additions & 3 deletions lib/logflare/context_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ defmodule Logflare.ContextCache do
value.id

true ->
# Logger.warn("Cached unknown value from context.", error_string: inspect(value))
# Logger.warning("Cached unknown value from context.", error_string: inspect(value))
"true"

nil ->
# Logger.warn("Cached unknown value from context.", error_string: inspect(value))
# Logger.warning("Cached unknown value from context.", error_string: inspect(value))
:not_found

_value ->
# Logger.warn("Unhandled cache key for value.", error_string: inspect(value))
# Logger.warning("Unhandled cache key for value.", error_string: inspect(value))
:uknown
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/endpoints/cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Logflare.Endpoints.Cache do
GenServer.call(cache, :query, 30_000)
catch
:exit, {:timeout, _call} ->
Logger.warn("Endpoint query timeout")
Logger.warning("Endpoint query timeout")

message = """
Backend query timeout! Optimizing your query will help. Some tips:
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/google/bigquery/bigquery.ex
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ defmodule Logflare.Google.BigQuery do
{:error, :not_patched}

{:error, response} ->
Logger.warn("Dataset labels NOT patched: #{dataset_id}", error_string: inspect(response))
Logger.warning("Dataset labels NOT patched: #{dataset_id}", error_string: inspect(response))
{:error, :not_patched}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/google/bigquery/schema_utils/schema_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ defmodule Logflare.Google.BigQuery.SchemaUtils do
%{t: bq_type_to_ex(t)}

true ->
Logger.warn("Unexpected value of TFS mode: #{mode}")
Logger.warning("Unexpected value of TFS mode: #{mode}")
%{t: bq_type_to_ex(t)}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/log_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ defmodule Logflare.LogEvent do
DateTime.to_unix(udt, :microsecond)

{:error, _} ->
# Logger.warn(
# Logger.warning(
# "Malformed timesetamp. Using DateTime.utc_now/0. Expected iso8601. Got: #{inspect(x)}"
# )

Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/netlify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule Logflare.Logs.Netlify do
defp custom_message(event) do
case Jason.encode(event) do
{:ok, json} ->
Logger.warn("Unhandled Netlify log event!", error_string: inspect(event))
Logger.warning("Unhandled Netlify log event!", error_string: inspect(event))
json

{:error, reason} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/search/logs_search_query_executor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ defmodule Logflare.Logs.SearchQueryExecutor do
:ok

{:error, _result} ->
Logger.warn("Streaming buffer not found for source #{source.token}")
Logger.warning("Streaming buffer not found for source #{source.token}")
end
end)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Logflare.Logs.Validators.EqDeepFieldTypes do
end
rescue
e ->
Logger.warn("Unexpected error at #{__MODULE__}: #{Exception.message(e)}")
Logger.warning("Unexpected error at #{__MODULE__}: #{Exception.message(e)}")
{:error, "Log event payload validation error"}
catch
:type_error ->
Expand Down
12 changes: 6 additions & 6 deletions lib/logflare/source/bigquery/pipeline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do
messages

{:ok, %GoogleApi.BigQuery.V2.Model.TableDataInsertAllResponse{insertErrors: errors}} ->
Logger.warn("BigQuery insert errors.", error_string: inspect(errors))
Logger.warning("BigQuery insert errors.", error_string: inspect(errors))

messages

Expand All @@ -114,7 +114,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do
# messages

_message ->
Logger.warn("Stream batch response error!",
Logger.warning("Stream batch response error!",
tesla_response: GenUtils.get_tesla_error_message(response)
)

Expand All @@ -126,15 +126,15 @@ defmodule Logflare.Source.BigQuery.Pipeline do
messages

{:error, :timeout = response} ->
Logger.warn("Stream batch timeout error!", tesla_response: response)
Logger.warning("Stream batch timeout error!", tesla_response: response)
messages

{:error, :checkout_timeout = response} ->
Logger.warn("Stream batch checkout_timeout error!", tesla_response: response)
Logger.warning("Stream batch checkout_timeout error!", tesla_response: response)
messages

{:error, response} ->
Logger.warn("Stream batch unknown error!", tesla_response: inspect(response))
Logger.warning("Stream batch unknown error!", tesla_response: inspect(response))
messages
end
end
Expand Down Expand Up @@ -176,7 +176,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do
|> AccountEmail.backend_disconnected(message)
|> Mailer.deliver()

Logger.warn("Backend disconnected for: #{user.email}", tesla_response: message)
Logger.warning("Backend disconnected for: #{user.email}", tesla_response: message)

{:error, changeset} ->
Logger.error("Failed to reset backend for user: #{user.email}",
Expand Down
8 changes: 4 additions & 4 deletions lib/logflare/source/bigquery/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,23 @@ defmodule Logflare.Source.BigQuery.Schema do
}}

{:error, response} ->
Logger.warn("Source schema update error!",
Logger.warning("Source schema update error!",
tesla_response: BigQuery.GenUtils.get_tesla_error_message(response)
)

{:reply, :error, %{state | next_update: next_update()}}
end

{:error, response} ->
Logger.warn("Source schema update error!",
Logger.warning("Source schema update error!",
tesla_response: BigQuery.GenUtils.get_tesla_error_message(response)
)

{:reply, :error, %{state | next_update: next_update()}}
end

message ->
Logger.warn("Source schema update error!",
Logger.warning("Source schema update error!",
tesla_response: message
)

Expand Down Expand Up @@ -307,7 +307,7 @@ defmodule Logflare.Source.BigQuery.Schema do
pipeline_process_data_stacktrace: LogflareLogger.Stacktrace.format(__STACKTRACE__)
})

Logger.warn("Field schema type change error!", error_string: inspect(e))
Logger.warning("Field schema type change error!", error_string: inspect(e))

schema
end
Expand Down
10 changes: 5 additions & 5 deletions lib/logflare/source/slack_hook_server/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Logflare.Source.SlackHookServer.Client do
{:ok, %Tesla.Env{body: "invalid_blocks"} = response} ->
resp = prep_tesla_resp_for_log(response)

Logger.warn("Slack hook response: invalid_blocks",
Logger.warning("Slack hook response: invalid_blocks",
slackhook_response: resp,
slackhook_request: %{url: url, body: inspect(body)}
)
Expand All @@ -49,11 +49,11 @@ defmodule Logflare.Source.SlackHookServer.Client do
{:ok, %Tesla.Env{body: "no_service"} = response} ->
resp = prep_tesla_resp_for_log(response)

Logger.warn("Slack hook response: no_service", slackhook_response: resp)
Logger.warning("Slack hook response: no_service", slackhook_response: resp)

case Sources.delete_slack_hook_url(source) do
{:ok, _source} ->
Logger.warn("Slack hook url deleted.")
Logger.warning("Slack hook url deleted.")

{:error, _changeset} ->
Logger.error("Error deleting Slack hook url.")
Expand All @@ -64,14 +64,14 @@ defmodule Logflare.Source.SlackHookServer.Client do
{:ok, %Tesla.Env{} = response} ->
resp = prep_tesla_resp_for_log(response)

Logger.warn("Slack hook error!", slackhook_response: resp)
Logger.warning("Slack hook error!", slackhook_response: resp)

{:error, response}

{:error, response} ->
resp = prep_tesla_resp_for_log(response)

Logger.warn("Slack hook error!", slackhook_response: resp)
Logger.warning("Slack hook error!", slackhook_response: resp)
{:error, response}
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/logflare/source/webhook_notification_server/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Logflare.Source.WebhookNotificationServer.Client do
{:ok, response}

{:ok, %Tesla.Env{} = response} ->
Logger.warn("Webhook error!",
Logger.warning("Webhook error!",
webhook_request: %{url: url, body: inspect(payload)},
webhook_response: %{
body: inspect(response.body),
Expand All @@ -58,7 +58,7 @@ defmodule Logflare.Source.WebhookNotificationServer.Client do
{:error, response}

{:error, response} ->
Logger.warn("Webhook error!", webhook_response: %{error: inspect(response)})
Logger.warning("Webhook error!", webhook_response: %{error: inspect(response)})
{:error, response}
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ defmodule Logflare.Source.WebhookNotificationServer.DiscordClient do
{:ok, response}

{:ok, %Tesla.Env{} = response} ->
Logger.warn("Webhook error!",
Logger.warning("Webhook error!",
webhook_request: %{url: url, body: inspect(payload)},
webhook_response: %{
body: inspect(response.body),
Expand All @@ -73,7 +73,7 @@ defmodule Logflare.Source.WebhookNotificationServer.DiscordClient do
{:error, response}

{:error, response} ->
Logger.warn("Webhook error!", webhook_response: %{error: inspect(response)})
Logger.warning("Webhook error!", webhook_response: %{error: inspect(response)})
{:error, response}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/system_metrics/all_logs_logged/poller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Logflare.SystemMetrics.AllLogsLogged.Poller do
# Getting messages from tracker here for some reason.
# Logflare.SystemMetrics.AllLogsLogged.Poller.handle_info({#Reference<0.2515045418.1638137859.219426>, {:ok, "Fl6TQMxzPJKX90GH"}}, %{init_total: 1384387391, inserts_since_init: 93034149, last_second: 472, last_total: 1480439241})

Logger.warn("Handle Tracker message.")
Logger.warning("Handle Tracker message.")

{:noreply, state}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/logflare_web/controllers/admin_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ defmodule LogflareWeb.AdminController do
|> put_status(:ok)
|> json(%{"message" => "Success, shutting down node: #{node}"})
else
Logger.warn("Node shutdown requested!")
Logger.warning("Node shutdown requested!")

conn
|> put_status(:unauthorized)
Expand All @@ -124,7 +124,7 @@ defmodule LogflareWeb.AdminController do
end

defp do_unauthorized_code_shutdown(conn, _params) do
Logger.warn("Node shutdown requested!")
Logger.warning("Node shutdown requested!")

conn
|> put_status(:unauthorized)
Expand Down
6 changes: 3 additions & 3 deletions lib/logflare_web/controllers/auth/oauth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule LogflareWeb.Auth.OauthController do
alias Logflare.Alerting

def request(conn, params) do
Logger.warn("Received unrecognized Oauth provider request", error_string: inspect(params))
Logger.warning("Received unrecognized Oauth provider request", error_string: inspect(params))
auth_error_redirect(conn)
end

Expand Down Expand Up @@ -106,15 +106,15 @@ defmodule LogflareWeb.Auth.OauthController do
%{assigns: %{ueberauth_failure: failure}} = conn,
%{"provider" => provider} = params
) do
Logger.warn("Oauth failure for #{provider}. #{inspect(failure)}",
Logger.warning("Oauth failure for #{provider}. #{inspect(failure)}",
error_string: inspect(params)
)

auth_error_redirect(conn)
end

def callback(conn, params) do
Logger.warn("Received unrecognized Oauth provider callback request",
Logger.warning("Received unrecognized Oauth provider callback request",
error_string: inspect(params)
)

Expand Down
2 changes: 1 addition & 1 deletion lib/logflare_web/controllers/stripe_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ defmodule LogflareWeb.StripeController do
type = LogflareLogger.context().billing.webhook_type
message = "customer not found: #{customer}"

Logger.warn("Stripe webhook: #{type}")
Logger.warning("Stripe webhook: #{type}")

ok(conn, message)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare_web/live/admin/cluster_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule LogflareWeb.Admin.ClusterLive do

def handle_event("shutdown", %{"node" => node}, socket) do
msg = "Node shutdown initiated for #{node}"
Logger.warn(msg)
Logger.warning(msg)

String.to_atom(node) |> Admin.shutdown()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ defmodule LogflareWeb.Search.LogEventViewerComponent do
[from, to] = params.partitions_range

err = "Log event with id #{params[:id]} between #{from} and #{to} was not found"
Logger.warn(err)
Logger.warning(err)
err

e ->
Expand Down
10 changes: 5 additions & 5 deletions lib/sig_term_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Logflare.SigtermHandler do

@impl true
def handle_info(:proceed_with_sigterm, state) do
Logger.warn("#{__MODULE__}: shutdown grace period reached, stopping the app...")
Logger.warning("#{__MODULE__}: shutdown grace period reached, stopping the app...")

System.stop()

Expand All @@ -25,7 +25,7 @@ defmodule Logflare.SigtermHandler do

@impl true
def handle_event(:sigterm, state) do
Logger.warn(
Logger.warning(
"#{__MODULE__}: SIGTERM received: waiting for #{env_grace_period() / 1_000} seconds"
)

Expand All @@ -38,7 +38,7 @@ defmodule Logflare.SigtermHandler do
end

def handle_event(:sigquit, state) do
Logger.warn(
Logger.warning(
"#{__MODULE__}: SIGQUIT received: waiting for #{env_grace_period() / 1_000} seconds"
)

Expand All @@ -49,14 +49,14 @@ defmodule Logflare.SigtermHandler do

@impl true
def handle_event(ev, state) do
Logger.warn("#{__MODULE__}: has received a system signal: #{ev} and is ignoring it")
Logger.warning("#{__MODULE__}: has received a system signal: #{ev} and is ignoring it")

{:ok, state}
end

@impl true
def handle_call(msg, state) do
Logger.warn("#{__MODULE__} has received an unexpected call: #{inspect(msg)}")
Logger.warning("#{__MODULE__} has received an unexpected call: #{inspect(msg)}")
{:ok, :ok, state}
end
end

0 comments on commit 83d8f34

Please sign in to comment.