Last active
December 13, 2015 18:48
-
-
Save toolmantim/4957786 to your computer and use it in GitHub Desktop.
Filtering asset requests from the development log using Rails 3.2
This file contains hidden or 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
# Add the following configuration to your config/environments/development.rb file | |
# | |
# This will set the Rails to log to STDOUT (insetad of log/development.log) as well | |
# as tag all assets request log lines with [assets] | |
# | |
# You can then pipe it into grep to filter out the asset lines | |
# | |
# tail -f log/development.rb | grep -v '\[assets\]' | |
# | |
# If you log to STDOUT rather than log/development.rb then you can: | |
# | |
# rails s | grep -v '\[assets\]' | |
# | |
# or: | |
# | |
# foreman start | grep -v '\[assets\]' | |
SomeApp::Application.configure do | |
# Tag assets requests log lines with [assets] | |
config.log_tags = [ | |
-> request { :assets if request.path.starts_with?(config.assets.prefix) }, | |
-> request { nil } | |
] | |
# If you want to log to STDOUT rather than log files | |
# config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tend to use: https://github.com/evrone/quiet_assets since most of the time I don't actually need to see asset requests and if I'm debugging something I can just flick them on.
Still a really cool trick!