Removing asset loading from error logs

Can I remove a load of assets (such as images) from magazines? I would like to have only a view representation in my magazine + with activerecord stuff and no other things that are distracting.

Can you configure the registrar to remove certain items from the log, such as loading an asset? THX

+6
source share
3 answers

You can add initializer pretty_assets.rb with:

def is_windows? RUBY_PLATFORM['mswin32'] || RUBY_PLATFORM['mingw'] || RUBY_PLATFORM['cygwin'] end destination = is_windows?? 'NUL' : '/dev/null' Rails.application.assets.logger = Logger.new(destination) 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'].index("/assets/") == 0 call_without_quiet_assets(env).tap do Rails.logger.level = previous_level end end alias_method_chain :call, :quiet_assets end 
+3
source

In case anyone else stumbles upon this, as I did here, this is a simpler solution. https://github.com/evrone/quiet_assets

+1
source

Add this line to your development.rb file.

 config.assets.debug = false 
+1
source

Source: https://habr.com/ru/post/907102/


All Articles