Sha256: d283d5fe8131fc2042c4154d2822e23fa61eb03097c4d69f945c9d9e8ce78e83

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

require 'standby/version'

module ActiveRecord
  class LogSubscriber

    alias_method :debug_without_standby, :debug

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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
standby-5.0.0 lib/standby/active_record/log_subscriber.rb