mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Using Native ActiveRecord Logger
Starting in Rails 5.2 there's a new setting to log ActiveRecord queries making the LogQuerySource not needed anymore
This commit is contained in:
parent
f50a92bf53
commit
2d17ce2667
2 changed files with 1 additions and 18 deletions
|
|
@ -113,5 +113,5 @@ Osem::Application.configure do
|
|||
devise_config.ichain_test_mode = true
|
||||
end
|
||||
end
|
||||
|
||||
config.active_record.verbose_query_logs = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
# http://www.jkfill.com/2015/02/14/log-which-line-caused-a-query/
|
||||
module LogQuerySource
|
||||
def debug(*args, &block)
|
||||
return unless super
|
||||
|
||||
backtrace = Rails.backtrace_cleaner.clean caller
|
||||
|
||||
relevant_caller_line = backtrace.detect do |caller_line|
|
||||
!caller_line.include?('/initializers/')
|
||||
end
|
||||
|
||||
if relevant_caller_line
|
||||
logger.debug(" ↳ #{ relevant_caller_line.sub("#{ Rails.root }/", '') }")
|
||||
end
|
||||
end
|
||||
end
|
||||
ActiveRecord::LogSubscriber.send :prepend, LogQuerySource
|
||||
Loading…
Add table
Add a link
Reference in a new issue