aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/notifications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/notifications.rb')
-rw-r--r--activerecord/lib/active_record/notifications.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/notifications.rb b/activerecord/lib/active_record/notifications.rb
new file mode 100644
index 0000000000..562a5b91f4
--- /dev/null
+++ b/activerecord/lib/active_record/notifications.rb
@@ -0,0 +1,5 @@
+require 'active_support/notifications'
+
+ActiveSupport::Notifications.subscribe("sql") do |name, before, after, result, instrumenter_id, payload|
+ ActiveRecord::Base.connection.log_info(payload[:sql], name, after - before)
+end