Drop Logger backends (#4862)

* drop console logger backend

* ah, switch Sentry too
This commit is contained in:
ruslandoga 2024-11-28 19:18:35 +07:00 committed by GitHub
parent 7f4c2b6fb7
commit 24888cff3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 16 deletions

View File

@ -26,26 +26,15 @@ log_level =
|> get_var_from_path_or_env("LOG_LEVEL", default_log_level) |> get_var_from_path_or_env("LOG_LEVEL", default_log_level)
|> String.to_existing_atom() |> String.to_existing_atom()
config :logger, config :logger, level: log_level
level: log_level, config :logger, :default_formatter, metadata: [:request_id]
backends: [:console]
config :logger, Sentry.LoggerBackend,
capture_log_messages: true,
level: :error
case String.downcase(log_format) do case String.downcase(log_format) do
"standard" -> "standard" ->
config :logger, :console, config :logger, :default_formatter, format: "$time $metadata[$level] $message\n"
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
"json" -> "json" ->
config :logger, :console, config :logger, :default_formatter, format: {ExJsonLogger, :format}
format: {ExJsonLogger, :format},
metadata: [
:request_id
]
end end
# Listen IP supports IPv4 and IPv6 addresses. # Listen IP supports IPv4 and IPv6 addresses.

View File

@ -226,7 +226,9 @@ defmodule Plausible.Application do
end end
def setup_sentry() do def setup_sentry() do
Logger.add_backend(Sentry.LoggerBackend) :logger.add_handler(:sentry_handler, Sentry.LoggerHandler, %{
config: %{capture_log_messages: true, level: :error}
})
:telemetry.attach_many( :telemetry.attach_many(
"oban-errors", "oban-errors",