Skip to content

Instantly share code, notes, and snippets.

@jcasimir
Created February 3, 2012 07:26
Show Gist options
  • Save jcasimir/1728751 to your computer and use it in GitHub Desktop.
Save jcasimir/1728751 to your computer and use it in GitHub Desktop.
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
@jcasimir
Copy link
Author

jcasimir commented Feb 6, 2012

I like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment