Stopped logging healthcheck requests

This commit is contained in:
Kieran Eglin 2025-03-17 14:32:38 -07:00
parent 4554648ba7
commit 9195f4f79c
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 9 additions and 2 deletions

View file

@ -39,7 +39,10 @@ defmodule PinchflatWeb.Endpoint do
cookie_key: "request_logger"
plug Plug.RequestId
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Telemetry,
event_prefix: [:phoenix, :endpoint],
log: {__MODULE__, :log_level, []}
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
@ -55,6 +58,10 @@ defmodule PinchflatWeb.Endpoint do
plug PinchflatWeb.Router
# Disables logging in Plug.Telemetry for healthcheck requests
def log_level(%Plug.Conn{path_info: ["healthcheck"]}), do: false
def log_level(_), do: :info
# URLs need to be generated using the host of the current page being accessed
# for things like Podcast RSS feeds to contain links to the right location.
#

View file

@ -68,7 +68,7 @@ defmodule PinchflatWeb.Router do
scope "/", PinchflatWeb do
pipe_through :api
get "/healthcheck", HealthController, :check
get "/healthcheck", HealthController, :check, log: false
end
scope "/dev" do