Skip to content

Instantly share code, notes, and snippets.

@gotmayonase
Created September 23, 2013 20:05
Show Gist options
  • Save gotmayonase/6676136 to your computer and use it in GitHub Desktop.
Save gotmayonase/6676136 to your computer and use it in GitHub Desktop.
class DisableAssetsLogger
def initialize(app)
@app = app
Rails.application.assets.logger = Logger.new('/dev/null')
end
def call(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
@app.call(env)
ensure
Rails.logger.level = previous_level
end
end
Blah::Application.configure do
config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment