Created
April 12, 2012 22:11
-
-
Save bsodmike/2371388 to your computer and use it in GitHub Desktop.
Example of subscribing to ActiveSupport::Notifications in Rails 3.2.3
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
| notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 {:controller=>"Devise::SessionsController", :action=>"new", :params=>{"action"=>"new", "controller"=>"devise/sessions"}, :format=>:html, :method=>"GET", :path=>"/login/sign_in", :status=>200, :view_runtime=>279.3080806732178, :db_runtime=>40.053} |
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 to config/initializers | |
| module ActionController | |
| class PageRequest | |
| def call(name, started, finished, unique_id, payload) | |
| Rails.logger.debug ["notification:", name, started, finished, unique_id, payload].join(" ") | |
| end | |
| end | |
| end | |
| ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment