-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent logging access to a route #1582
Comments
I haven't tested this but take a look at silencer. Depending on how you configure your app, Rack may be adding logging middleware. See: https://stackoverflow.com/questions/30471322/disable-sinatra-standard-output If you make sure CommonLogger is disabled, and then use Silencer I think you might be good. |
I think the challenge is to be able to suppress the access logs per route instead of globally. |
Per the Silencer readme:
Being Rack middleware, I think it should work with SInatra as well. This is a Rack example from the readme:
|
Hm, so that very well might not work for you. You might reach a bigger audience for this question on StackOverflow. I'm guessing someone has come across this before. |
@scalp42 we've just merged in a new feature to master. I think you might be able to use this to prevent logging to your ping route. Can you check and let me know if this will work? https://github.com/sinatra/sinatra/blob/master/sinatra-contrib/lib/sinatra/quiet_logger.rb See also: #1250 |
Awesome @jkowens! thanks a lot, I'll give it a try by hopefully end of month but I'm assuming we should be able to close this issue now. Thanks again. |
@jkowens any idea how to use it when not using a modular app? |
Hi folks,
We have a simple route `/ping and we'd like to prevent logging access to it.
What is the recommended way to do that?
Thank you in advance
The text was updated successfully, but these errors were encountered: