Class: IIInteractor::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/ii_interactor/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#additional_log(event) ⇒ Object



12
13
14
15
16
# File 'lib/ii_interactor/log_subscriber.rb', line 12

def additional_log(event)
  additions = ["Duration: %.1fms" % event.duration]
  additions << "Allocations: %d" % event.allocations if event.respond_to?(:allocations)
  additions.join(', ')
end

#call(event) ⇒ Object



5
6
7
8
9
10
# File 'lib/ii_interactor/log_subscriber.rb', line 5

def call(event)
  debug do
    interactor = event.payload[:interactor]
    "Called #{interactor.class} (#{additional_log(event)})"
  end
end