关闭 asset pipeline (sprockets)日志消息

前端之家收集整理的这篇文章主要介绍了关闭 asset pipeline (sprockets)日志消息前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

新建 config/initializers/quiet_assets.rb



if Rails.env.development? Rails.application.assets.logger = Logger.new(File.join(Rails.root,'log/assets.log')) Rails::Rack::Logger.class_eval do def call_with_quiet_assets(env) prevIoUs_level = Rails.logger.level Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/} call_without_quiet_assets(env) ensure Rails.logger.level = prevIoUs_level end alias_method_chain :call,:quiet_assets endend

猜你在找的设计模式相关文章