Sha256: 1ddc921b9b395d82e381043905596c5648eb2aa8637e5f66a51553ca37aec214

Contents?: true

Size: 370 Bytes

Versions: 1

Compression:

Stored size: 370 Bytes

Contents

require "active_support/log_subscriber"

class Linger::LogSubscriber < ActiveSupport::LogSubscriber
  def meta(event)
    info formatted_in(MAGENTA, event)
  end

  private

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

Linger::LogSubscriber.attach_to :linger

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linger-0.1.0 lib/linger/log_subscriber.rb