Class: ActiveRecord::LogSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/standby/active_record/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#debug(msg) ⇒ Object



8
9
10
11
# File 'lib/standby/active_record/log_subscriber.rb', line 8

def debug(msg)
  db = Standby.disabled ? '' : log_header
  debug_without_standby(db + msg)
end

#debug_without_standbyObject



6
# File 'lib/standby/active_record/log_subscriber.rb', line 6

alias_method :debug_without_standby, :debug

#log_headerObject



13
14
15
16
17
18
19
# File 'lib/standby/active_record/log_subscriber.rb', line 13

def log_header
  if Standby.version_gte?('7.1')
    color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true)
  else
    color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true)
  end
end