A simple plug to suppress health check logging. Useful when running apps in Kubernetes.
The package can be installed by adding quiet_logger
to your list of
dependencies in mix.exs
:
def deps do
[
{:quiet_logger, "~> 0.2.0"}
]
end
Once that's done you can replace Plug.Logger
with Plug.QuietLogger
in your
endpoint.ex
file and you're ready to go.
If you need to customize the request path you want to suppress logging for, you
can pass it with the plug
call:
plug Plug.QuietLogger, path: "/api/status"
You can also pass a list of paths to filter out, like:
plug Plug.QuietLogger, path: [ "/api/status", "/api/readiness" ]
If you want to change your logging level you can also set it the same way you
would with Plug.Logger
:
plug Plug.QuietLogger, log: :debug