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)
|> String.to_existing_atom()
config :logger,
level: log_level,
backends: [:console]
config :logger, Sentry.LoggerBackend,
capture_log_messages: true,
level: :error
config :logger, level: log_level
config :logger, :default_formatter, metadata: [:request_id]
case String.downcase(log_format) do
"standard" ->
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
config :logger, :default_formatter, format: "$time $metadata[$level] $message\n"
"json" ->
config :logger, :console,
format: {ExJsonLogger, :format},
metadata: [
:request_id
]
config :logger, :default_formatter, format: {ExJsonLogger, :format}
end
# Listen IP supports IPv4 and IPv6 addresses.

View File

@ -226,7 +226,9 @@ defmodule Plausible.Application do
end
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(
"oban-errors",