mirror of
https://github.com/plausible/analytics.git
synced 2025-01-05 17:16:44 +03:00
Drop Logger backends (#4862)
* drop console logger backend * ah, switch Sentry too
This commit is contained in:
parent
7f4c2b6fb7
commit
24888cff3c
@ -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.
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user