aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorStan Lo <a22301613@yahoo.com.tw>2016-07-14 18:38:16 +0800
committerStan Lo <a22301613@yahoo.com.tw>2016-08-08 00:24:39 +0800
commitab2af4dfcb61b568a9753b97dc55f1b45e3a824e (patch)
tree2e94a186941b1b890492828cefcaba1144b70836 /actionpack/lib/action_controller
parentc4f8c45ba57e97e8dfc99f8bf6c2fbfd39abd58b (diff)
downloadrails-ab2af4dfcb61b568a9753b97dc55f1b45e3a824e.tar.gz
rails-ab2af4dfcb61b568a9753b97dc55f1b45e3a824e.tar.bz2
rails-ab2af4dfcb61b568a9753b97dc55f1b45e3a824e.zip
Modify LogSubscriber for single partial's cache message.
Implement naive partial caching mechanism. Add test for LogSubscriber Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it. Fixed tests Remove useless settings Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload. Update test's hash syntax Add configuration to enable/disable fragment caching logging Remove unless test and add new test to ensure cache info won't effect next rendering's log Move :enable_fragment_cache_logging config from ActionView to ActionPack Apply new config to tests Update actionview's changelog Update configuration guide Improve actionview's changelog Refactor PartialRenderer#render and log tests Mute subscriber's log instead of disabling instrumentation. Fix typo, remove useless comment and use new hash syntax Improve actionpack's log_subscriber test Fix rebase mistake Apply new config to all caching intstrument actions
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/log_subscriber.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/log_subscriber.rb b/actionpack/lib/action_controller/log_subscriber.rb
index a0917b4fdb..739a11679b 100644
--- a/actionpack/lib/action_controller/log_subscriber.rb
+++ b/actionpack/lib/action_controller/log_subscriber.rb
@@ -59,14 +59,13 @@ module ActionController
expire_fragment expire_page write_page).each do |method|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{method}(event)
- return unless logger.info?
+ return unless logger.info? && ActionController::Base.enable_fragment_cache_logging
key_or_path = event.payload[:key] || event.payload[:path]
human_name = #{method.to_s.humanize.inspect}
info("\#{human_name} \#{key_or_path} (\#{event.duration.round(1)}ms)")
end
METHOD
end
-
def logger
ActionController::Base.logger
end