From 83d8f34cb2dd8d1eddd01cebbb16537886467bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Wed, 4 Oct 2023 13:41:29 +0200 Subject: [PATCH] chore: replace calls to Logger.warn with Logger.warning --- lib/logflare/admin.ex | 2 +- lib/logflare/context_cache.ex | 6 +++--- lib/logflare/endpoints/cache.ex | 2 +- lib/logflare/google/bigquery/bigquery.ex | 2 +- .../google/bigquery/schema_utils/schema_utils.ex | 2 +- lib/logflare/logs/log_event.ex | 2 +- lib/logflare/logs/netlify.ex | 2 +- .../logs/search/logs_search_query_executor.ex | 2 +- .../logs/validators/eq_deep_field_types_validator.ex | 2 +- lib/logflare/source/bigquery/pipeline.ex | 12 ++++++------ lib/logflare/source/bigquery/schema.ex | 8 ++++---- lib/logflare/source/slack_hook_server/client.ex | 10 +++++----- .../source/webhook_notification_server/client.ex | 4 ++-- .../webhook_notification_server/discord_client.ex | 4 ++-- .../system_metrics/all_logs_logged/poller.ex | 2 +- lib/logflare_web/controllers/admin_controller.ex | 4 ++-- .../controllers/auth/oauth_controller.ex | 6 +++--- lib/logflare_web/controllers/stripe_controller.ex | 2 +- lib/logflare_web/live/admin/cluster_live.ex | 2 +- .../search_log_event_viewer_component.ex | 2 +- lib/sig_term_handler.ex | 10 +++++----- 21 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib/logflare/admin.ex b/lib/logflare/admin.ex index 30e7a92f6..bddf66bbc 100644 --- a/lib/logflare/admin.ex +++ b/lib/logflare/admin.ex @@ -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, []) diff --git a/lib/logflare/context_cache.ex b/lib/logflare/context_cache.ex index 6c7f573fc..5c4954f29 100644 --- a/lib/logflare/context_cache.ex +++ b/lib/logflare/context_cache.ex @@ -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 diff --git a/lib/logflare/endpoints/cache.ex b/lib/logflare/endpoints/cache.ex index 22db48b2d..fcbbfd5bb 100644 --- a/lib/logflare/endpoints/cache.ex +++ b/lib/logflare/endpoints/cache.ex @@ -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: diff --git a/lib/logflare/google/bigquery/bigquery.ex b/lib/logflare/google/bigquery/bigquery.ex index ce82519b2..6f2e9e25b 100644 --- a/lib/logflare/google/bigquery/bigquery.ex +++ b/lib/logflare/google/bigquery/bigquery.ex @@ -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 diff --git a/lib/logflare/google/bigquery/schema_utils/schema_utils.ex b/lib/logflare/google/bigquery/schema_utils/schema_utils.ex index 1ab30d566..649eb8df0 100644 --- a/lib/logflare/google/bigquery/schema_utils/schema_utils.ex +++ b/lib/logflare/google/bigquery/schema_utils/schema_utils.ex @@ -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 diff --git a/lib/logflare/logs/log_event.ex b/lib/logflare/logs/log_event.ex index 5373effca..e8b2143a2 100644 --- a/lib/logflare/logs/log_event.ex +++ b/lib/logflare/logs/log_event.ex @@ -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)}" # ) diff --git a/lib/logflare/logs/netlify.ex b/lib/logflare/logs/netlify.ex index 1a290ec7d..374b4711a 100644 --- a/lib/logflare/logs/netlify.ex +++ b/lib/logflare/logs/netlify.ex @@ -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} -> diff --git a/lib/logflare/logs/search/logs_search_query_executor.ex b/lib/logflare/logs/search/logs_search_query_executor.ex index f554603b9..8fbb35356 100644 --- a/lib/logflare/logs/search/logs_search_query_executor.ex +++ b/lib/logflare/logs/search/logs_search_query_executor.ex @@ -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 diff --git a/lib/logflare/logs/validators/eq_deep_field_types_validator.ex b/lib/logflare/logs/validators/eq_deep_field_types_validator.ex index 6368f85fa..d7ffe070f 100644 --- a/lib/logflare/logs/validators/eq_deep_field_types_validator.ex +++ b/lib/logflare/logs/validators/eq_deep_field_types_validator.ex @@ -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 -> diff --git a/lib/logflare/source/bigquery/pipeline.ex b/lib/logflare/source/bigquery/pipeline.ex index c9d26a1ac..9cfadc448 100644 --- a/lib/logflare/source/bigquery/pipeline.ex +++ b/lib/logflare/source/bigquery/pipeline.ex @@ -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 @@ -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) ) @@ -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 @@ -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}", diff --git a/lib/logflare/source/bigquery/schema.ex b/lib/logflare/source/bigquery/schema.ex index d8362413f..d2029599c 100644 --- a/lib/logflare/source/bigquery/schema.ex +++ b/lib/logflare/source/bigquery/schema.ex @@ -191,7 +191,7 @@ 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) ) @@ -199,7 +199,7 @@ defmodule Logflare.Source.BigQuery.Schema do end {:error, response} -> - Logger.warn("Source schema update error!", + Logger.warning("Source schema update error!", tesla_response: BigQuery.GenUtils.get_tesla_error_message(response) ) @@ -207,7 +207,7 @@ defmodule Logflare.Source.BigQuery.Schema do end message -> - Logger.warn("Source schema update error!", + Logger.warning("Source schema update error!", tesla_response: message ) @@ -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 diff --git a/lib/logflare/source/slack_hook_server/client.ex b/lib/logflare/source/slack_hook_server/client.ex index 57fdc0f91..e023acf8e 100644 --- a/lib/logflare/source/slack_hook_server/client.ex +++ b/lib/logflare/source/slack_hook_server/client.ex @@ -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)} ) @@ -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.") @@ -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 diff --git a/lib/logflare/source/webhook_notification_server/client.ex b/lib/logflare/source/webhook_notification_server/client.ex index 7e00604ea..29e54e9ec 100644 --- a/lib/logflare/source/webhook_notification_server/client.ex +++ b/lib/logflare/source/webhook_notification_server/client.ex @@ -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), @@ -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 diff --git a/lib/logflare/source/webhook_notification_server/discord_client.ex b/lib/logflare/source/webhook_notification_server/discord_client.ex index a9dc483bb..e7215328c 100644 --- a/lib/logflare/source/webhook_notification_server/discord_client.ex +++ b/lib/logflare/source/webhook_notification_server/discord_client.ex @@ -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), @@ -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 diff --git a/lib/logflare/system_metrics/all_logs_logged/poller.ex b/lib/logflare/system_metrics/all_logs_logged/poller.ex index 140b965d3..834b948da 100644 --- a/lib/logflare/system_metrics/all_logs_logged/poller.ex +++ b/lib/logflare/system_metrics/all_logs_logged/poller.ex @@ -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 diff --git a/lib/logflare_web/controllers/admin_controller.ex b/lib/logflare_web/controllers/admin_controller.ex index f244bb0ad..bf513cb1f 100644 --- a/lib/logflare_web/controllers/admin_controller.ex +++ b/lib/logflare_web/controllers/admin_controller.ex @@ -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) @@ -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) diff --git a/lib/logflare_web/controllers/auth/oauth_controller.ex b/lib/logflare_web/controllers/auth/oauth_controller.ex index 1ebd48453..e757b4286 100644 --- a/lib/logflare_web/controllers/auth/oauth_controller.ex +++ b/lib/logflare_web/controllers/auth/oauth_controller.ex @@ -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 @@ -106,7 +106,7 @@ 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) ) @@ -114,7 +114,7 @@ defmodule LogflareWeb.Auth.OauthController do 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) ) diff --git a/lib/logflare_web/controllers/stripe_controller.ex b/lib/logflare_web/controllers/stripe_controller.ex index 941852671..c9567aeb0 100644 --- a/lib/logflare_web/controllers/stripe_controller.ex +++ b/lib/logflare_web/controllers/stripe_controller.ex @@ -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 diff --git a/lib/logflare_web/live/admin/cluster_live.ex b/lib/logflare_web/live/admin/cluster_live.ex index 7d6865cf6..d704a899c 100644 --- a/lib/logflare_web/live/admin/cluster_live.ex +++ b/lib/logflare_web/live/admin/cluster_live.ex @@ -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() diff --git a/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex b/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex index 30b55dbea..9d7b0e1c2 100644 --- a/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex +++ b/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex @@ -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 -> diff --git a/lib/sig_term_handler.ex b/lib/sig_term_handler.ex index 57298416e..c340d07fc 100644 --- a/lib/sig_term_handler.ex +++ b/lib/sig_term_handler.ex @@ -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() @@ -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" ) @@ -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" ) @@ -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