aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_controller/notifications.rb
blob: 1a4f29e0e23eaf0ff0042871d3d83a7ecae5ee52 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                      
 


                                                                                                       



                                                          
   
require 'active_support/notifications'

ActiveSupport::Notifications.subscribe(/(read|write|cache|expire|exist)_(fragment|page)\??/) do |*args|
  event = ActiveSupport::Notifications::Event.new(*args)

  if logger = ActionController::Base.logger
    human_name = event.name.to_s.humanize
    logger.info("#{human_name} (%.1fms)" % event.duration)
  end
end