Skip to content

Instantly share code, notes, and snippets.

@alexkojin
Created October 18, 2018 17:43
Show Gist options
  • Save alexkojin/008e2f154ecee9525a42d6f86ecf081a to your computer and use it in GitHub Desktop.
Save alexkojin/008e2f154ecee9525a42d6f86ecf081a to your computer and use it in GitHub Desktop.
class QuietActiveStorageLoggerMiddleware
def initialize(app)
@app = app
@regex = %r(\/rails\/active_storage)
end
def call(env)
if env['PATH_INFO'] =~ @regex
::Rails.logger.silence { @app.call(env) } # silences the logs!
else
@app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment