aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/notifications.rb
blob: 4ec88193d5ad7901b33320aeac0b06a9388fc8fc (plain) (blame)
1
2
3
4
5
6
7
8
require 'active_support/notifications'

ActiveSupport::Notifications.subscribe(/(read|write|cache|expire|exist)_(fragment|page)\??/) do |event|
  if logger = ActionController::Base.logger
    human_name = event.name.to_s.humanize
    logger.info("#{human_name} (%.1fms)" % event.duration)
  end
end