Skip to content

Commit

Permalink
Add connection logging in non-Rails enviroments
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane authored and rosa committed Nov 20, 2018
1 parent a506055 commit 01195ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/makara.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'active_support'
require 'makara/version'
require 'makara/railtie' if defined?(Rails)
module Makara
Expand Down Expand Up @@ -31,3 +32,9 @@ module Strategies
end

end

ActiveSupport.on_load(:active_record) do
ActiveRecord::LogSubscriber.log_subscribers.each do |subscriber|
subscriber.extend ::Makara::Logging::Subscriber
end
end
6 changes: 0 additions & 6 deletions lib/makara/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ class Railtie < ::Rails::Railtie
app.middleware.use Makara::Middleware
end

initializer "makara.initialize_logger" do |app|
ActiveRecord::LogSubscriber.log_subscribers.each do |subscriber|
subscriber.extend ::Makara::Logging::Subscriber
end
end

end
end

0 comments on commit 01195ef

Please sign in to comment.