Class: DisableAssetLogging::Middleware
- Inherits:
-
Object
- Object
- DisableAssetLogging::Middleware
- Defined in:
- lib/disable_asset_logging/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
3 4 5 6 |
# File 'lib/disable_asset_logging/middleware.rb', line 3 def initialize(app) @app = app Rails.application.assets.logger = Logger.new('/dev/null') end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/disable_asset_logging/middleware.rb', line 8 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 |