Skip to content

Instantly share code, notes, and snippets.

@ingeniarius
Last active October 1, 2015 04:07
Show Gist options
  • Save ingeniarius/1916625 to your computer and use it in GitHub Desktop.
Save ingeniarius/1916625 to your computer and use it in GitHub Desktop.
Disable rails 4 asset log messages
Rails::Rack::Logger.class_eval do
def call_app(request, env)
path = request.filtered_path
unless path.index("/assets/") == 0
# Put some space between requests in development logs.
if development?
logger.debug ''
logger.debug ''
end
instrumenter = ActiveSupport::Notifications.instrumenter
instrumenter.start 'request.action_dispatch', request: request
logger.info started_request_message(request)
end
resp = @app.call(env)
resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
resp
rescue
finish(request)
raise
ensure
ActiveSupport::LogSubscriber.flush_all!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment