All the tests pass with Rails 5, but when I include this gem in my upgraded rails 5 project, all requests stop logging shortly after the server starts (perhaps after the first silenced request). Has this been used successfully on a Rails 5 project?
I ended up rolling my own middleware that just inspects the HTTP_X_SILENCE_LOGGER which was the only way I was silencing requests.
class Rails::Rack::RequestSilencer
attr_reader :app, :options
def initialize(app, options={})
@app = app
@options = options
end
def silent_header?(env)
env['HTTP_X_SILENCE_LOGGER']
end
def call(env)
if silent_header?(env)
::Rails.logger.silence { @app.call(env) }
else
app.call(env)
end
end
end
All the tests pass with Rails 5, but when I include this gem in my upgraded rails 5 project, all requests stop logging shortly after the server starts (perhaps after the first silenced request). Has this been used successfully on a Rails 5 project?
I ended up rolling my own middleware that just inspects the
HTTP_X_SILENCE_LOGGERwhich was the only way I was silencing requests.