Created
February 3, 2012 07:26
-
-
Save jcasimir/1728751 to your computer and use it in GitHub Desktop.
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
class NullLogger < Logger | |
def initialize(*args); end | |
def write(*input); true; end | |
end | |
Rails.application.assets.logger = NullLogger.new | |
class Rails::Rack::Logger | |
alias_method :standard_call, :call | |
def temporary_level(level) | |
initial_level = Rails.logger.level | |
Rails.logger.level = level | |
yield | |
ensure | |
Rails.logger.level = initial_level | |
end | |
def call(env) | |
if env['PATH_INFO'] =~ /^\/assets\// | |
temporary_level(Logger::ERROR) { standard_call(env) } | |
else | |
standard_call(env) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also do:
Or even: