Closed acrao closed 9 years ago
Possible solution for #10
Thanks for the pull req. This would indeed solve the issue raised in #10. However, as I wrote in #10, I want ring.middleware.logger to remain purely focused on logging, without auxiliary code to do things like selective application. That sort of thing is not specific to ring.middleware.logger. If we do that in a generic fashion, we can re-use it with other middleware.
To that end, I've just written https://github.com/pjlegato/ring.middleware.conditional , which permits you to specify arbitrary conditions and URL filtering for any middleware. Could you please take a look and let me know whether that addresses the ignore-uri case adequately for you?
Interesting. I can see how keeping ring.middleware.logging focussed on logging is advantageous. I will take a look at ring.middleware.conditional later today. First impressions look like it'll solve the use case that I have.
Thanks for your prompt response.
@pjlegato ring.middleware.conditional works great. The one use case that I have that isn't covered is where I'd like logging to be ignored for a set of 3 or 4 routes which can't really be matched by a regex. For example "/healthz", "/statz", "/docs".
Maybe there could be an additional method if-url-doesnt-match-any
that could take a list of regex's and and uses
some``` to cycle through the regex's and stop at the first match? I could take a crack at this if you'd like.
@acrao, great, I'm glad to hear that it works well. I've opened a couple of issues over at the ring.middleware.conditional project for this -- could you take a look and add any suggestions you may have? https://github.com/pjlegato/ring.middleware.conditional/issues