introduce multi-path configuration#1
Conversation
problem: - sometimes you might have more than one healthcheck, eg. in Kubernetes we have readiness / liveliness checks solution: - extend the api to accept list of paths to ignore + tests
amencarini
left a comment
There was a problem hiding this comment.
Thanks a lot for this contribution, it's great stuff 😄 Have a look at my comments and let me know what you think. I'll quickly set up CI on this too, as I just noticed it's not yet running.
lib/plug/quiet_logger.ex
Outdated
| end | ||
|
|
||
| def call(%{request_path: path} = conn, %{log: :info, path: paths}) when is_list(paths) do | ||
| cond do |
There was a problem hiding this comment.
I normally prefer an if statement instead of a binary cond, it feels a bit clearer!
if path in paths, do: conn, else: Plug.Logger.call(conn, log)
What do you think?
lib/plug/quiet_logger.ex
Outdated
| %{log: log, path: path} | ||
| end | ||
|
|
||
| def call(%{request_path: path} = conn, %{log: :info, path: paths}) when is_list(paths) do |
There was a problem hiding this comment.
The hardcoded :info would prevent the configurability of the log level. Is that intended?
lib/plug/quiet_logger.ex
Outdated
| true -> Plug.Logger.call(conn, :info) | ||
| end | ||
|
|
||
| conn |
There was a problem hiding this comment.
You don't need this at the end of the function, you can safely rely on what's returned from the previous cond/if statement 🙂
|
@amencarini thanks for the feedback, looks cleaner now! |
|
Amazing, thank you so much, will push to hex momentarily 🌈 |
|
Thank you!
…On Tue, Jul 24, 2018, 2:44 PM Alessandro Mencarini ***@***.***> wrote:
Amazing, thank you so much, will push to hex momentarily 🌈
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAE0Lo9RwW8UP13gXA2T2RefJyoOveXks5uJxaqgaJpZM4VROo0>
.
|
problem:
solution: