Created
July 17, 2013 07:27
-
-
Save jackyu/6018402 to your computer and use it in GitHub Desktop.
[筆記][Rails] 將開發環境中的 asset log 過濾不顯示方式,參考 https://gist.github.com/toolmantim/4957786
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
# 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