mirror of
https://github.com/plausible/analytics.git
synced 2025-01-03 07:08:04 +03:00
Logger (#367)
* Fix error loading sessions after a restart * Add logflare logger
This commit is contained in:
parent
78ab16baa8
commit
d463814da7
@ -44,7 +44,9 @@ geolite2_country_db = System.get_env("GEOLITE2_COUNTRY_DB")
|
||||
disable_auth = String.to_existing_atom(System.get_env("DISABLE_AUTH", "false"))
|
||||
hcaptcha_sitekey = System.get_env("HCAPTCHA_SITEKEY")
|
||||
hcaptcha_secret = System.get_env("HCAPTCHA_SECRET")
|
||||
|
||||
logflare_api_key = System.get_env("LOGFLARE_API_KEY")
|
||||
logflare_source_id = System.get_env("LOGFLARE_SOURCE_ID")
|
||||
log_level = String.to_existing_atom(System.get_env("LOG_LEVEL", "warn"))
|
||||
|
||||
config :plausible,
|
||||
admin_user: admin_user,
|
||||
@ -192,4 +194,17 @@ if geolite2_country_db do
|
||||
]
|
||||
end
|
||||
|
||||
config :logger, level: :warn
|
||||
logger_backends = case logflare_api_key do
|
||||
api_key when is_binary(api_key) -> [LogflareLogger.HttpBackend]
|
||||
_ -> [:console]
|
||||
end
|
||||
|
||||
config :logger,
|
||||
level: log_level,
|
||||
backends: logger_backends
|
||||
|
||||
if logflare_api_key do
|
||||
config :logflare_logger_backend,
|
||||
api_key: logflare_api_key,
|
||||
source_id: logflare_source_id
|
||||
end
|
||||
|
3
mix.exs
3
mix.exs
@ -90,7 +90,8 @@ defmodule Plausible.MixProject do
|
||||
{:sshex, "2.2.1"},
|
||||
{:geolix, "~> 1.0"},
|
||||
{:clickhouse_ecto, git: "https://github.com/plausible/clickhouse_ecto.git"},
|
||||
{:geolix_adapter_mmdb2, "~> 0.5.0"}
|
||||
{:geolix_adapter_mmdb2, "~> 0.5.0"},
|
||||
{:logflare_logger_backend, "~> 0.7.6"},
|
||||
]
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user