updating game state

This commit is contained in:
2026-03-02 16:45:55 -07:00
parent c009d23e76
commit c86fbe9f67
4 changed files with 37 additions and 23 deletions

View File

@@ -46,6 +46,7 @@ defmodule BackendWeb.Endpoint do
)
plug(Plug.RequestId)
plug(BackendWeb.Plugs.HealthCheckLogger)
plug(BackendWeb.Plugs.Telemetry, event_prefix: [:phoenix, :endpoint])
plug(Plug.Parsers,

View File

@@ -1,17 +1,28 @@
defmodule BackendWeb.HealthCheckFilter do
defmodule BackendWeb.Plugs.HealthCheckLogger do
@moduledoc """
Custom Phoenix logger that filters out health check requests.
Plug that marks health check requests for filtering.
"""
@behaviour Plug
require Logger
def phoenix_filter(level, msg, ts, meta) do
# Filter out health check logs
case meta do
%{request_path: "/api/health"} ->
:ignore
@impl true
def init(opts), do: opts
_ ->
Phoenix.Logger.log(level, msg, ts, meta)
end
@impl true
def call(%Plug.Conn{path_info: ["api", "health"]} = conn, _opts) do
# Mark this as a health check for logger filtering
Logger.metadata(health_check: true)
conn
end
def call(conn, _opts), do: conn
end
defmodule BackendWeb.HealthCheckFilter do
@moduledoc """
Logger filter to suppress health check endpoint logs.
"""
def filter(%{meta: %{health_check: true}}, _config), do: :stop
def filter(_log_event, _config), do: :ignore
end