diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-30 09:52:52 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-30 09:53:09 +0100 |
commit | 38ab982cfff98570b5f12933cff489364845789c (patch) | |
tree | 20c563f1e1447234a1dfdb2e385c1ae06bd328ed /actionpack/lib | |
parent | a6ee246e5cea1c1a71631c6bef3740a4bf4eb250 (diff) | |
download | rails-38ab982cfff98570b5f12933cff489364845789c.tar.gz rails-38ab982cfff98570b5f12933cff489364845789c.tar.bz2 rails-38ab982cfff98570b5f12933cff489364845789c.zip |
Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time a before callback halts.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/log_subscriber.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/instrumentation.rb | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/log_subscriber.rb b/actionpack/lib/action_controller/log_subscriber.rb index 35e29398e6..8666ecc9c8 100644 --- a/actionpack/lib/action_controller/log_subscriber.rb +++ b/actionpack/lib/action_controller/log_subscriber.rb @@ -29,6 +29,10 @@ module ActionController info(message) end + def halted_callback(event) + info "Filter chain halted as #{event.payload[:filter]} rendered or redirected" + end + def send_file(event) message = "Sent file %s" message << " (%.1fms)" diff --git a/actionpack/lib/action_controller/metal/instrumentation.rb b/actionpack/lib/action_controller/metal/instrumentation.rb index 777a0ab343..640ebf5f00 100644 --- a/actionpack/lib/action_controller/metal/instrumentation.rb +++ b/actionpack/lib/action_controller/metal/instrumentation.rb @@ -64,7 +64,12 @@ module ActionController end end - protected + private + + # A hook invoked everytime a before callback is halted. + def halted_callback_hook(filter) + ActiveSupport::Notifications.instrument("halted_callback.action_controller", :filter => filter) + end # A hook which allows you to clean up any time taken into account in # views wrongly, like database querying time. |