Created
May 9, 2017 08:55
-
-
Save athurg/1175f58bc35dfcc1822bf5af4579a0ed to your computer and use it in GitHub Desktop.
用于将部分Rails请求日志屏蔽掉的代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# Place into Rails.root/config/initializers | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::FATAL if env['PATH_INFO']=="/silence/request" | |
call_without_quiet_assets(env).tap do | |
Rails.logger.level = previous_level | |
end | |
end | |
alias_method_chain :call, :quiet_assets | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment