module Octoball::LogSubscriber
Attributes
current_shard[RW]
Public Instance Methods
sql(event)
click to toggle source
Calls superclass method
# File lib/octoball/log_subscriber.rb, line 6 def sql(event) shard = event.payload[:connection]&.current_shard self.current_shard = shard == ActiveRecord::Base.default_shard ? nil : shard super end
Private Instance Methods
debug(progname = nil, &block)
click to toggle source
Calls superclass method
# File lib/octoball/log_subscriber.rb, line 14 def debug(progname = nil, &block) conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, true) : '' super(conn + progname.to_s, &block) end