Skip to content

Commit

Permalink
Added query time logger
Browse files Browse the repository at this point in the history
  • Loading branch information
thesecretmaster committed May 13, 2018
1 parent 6fa66d7 commit 3e0dcc8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/initializers/query_time_logger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'json'

logger = Logger.new('log/query_times.log')

logger.formatter = proc do |severity, datetime, progname, msg|
JSON.generate({time: datetime, msg: msg})
end

ActiveSupport::Notifications.subscribe('process_action.action_controller') do |**info|
logger.info (info)
end

0 comments on commit 3e0dcc8

Please sign in to comment.