Sha256: a3890e333324a6e9e6231ee9b6f4677256076ba03a751199d8c6f72abb7ca561

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

require "active_support/log_subscriber"

class Kredis::LogSubscriber < ActiveSupport::LogSubscriber
  def proxy(event)
    debug formatted_in(YELLOW, event, type: "Proxy")
  end

  def migration(event)
    debug formatted_in(YELLOW, event, type: "Migration")
  end

  def meta(event)
    info formatted_in(MAGENTA, event)
  end

  private
    def formatted_in(color, event, type: nil)
      color "  Kredis #{type} (#{event.duration.round(1)}ms)  #{event.payload[:message]}", color, bold: true
    end
end

Kredis::LogSubscriber.attach_to :kredis

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kredis-1.5.0 lib/kredis/log_subscriber.rb
kredis-1.4.0 lib/kredis/log_subscriber.rb