Class: ActionMessageTexter::LogSubscriber

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

Instance Method Summary collapse

Instance Method Details

#deliver(event) ⇒ Object

delivery log



6
7
8
9
10
11
12
13
14
# File 'lib/action_message_texter/log_subscriber.rb', line 6

def deliver(event)
  info do
    message = event.payload[:content]
    to = event.payload[:to]
    deliver_at = event.payload[:deliver_at]
    texter = event.payload[:texter]
    "#{texter}: Delivered message [#{message}] to #{to} at #{deliver_at}"
  end
end

#loggerObject



25
26
27
# File 'lib/action_message_texter/log_subscriber.rb', line 25

def logger
  ActionMessageTexter::Base.logger
end

#process(event) ⇒ Object

process message log



17
18
19
20
21
22
23
# File 'lib/action_message_texter/log_subscriber.rb', line 17

def process(event)
  debug do
    messenger = event.payload[:messenger]
    action = event.payload[:action]
    "#{messenger}##{action}: processed short Message in #{event.duration.round(1)}ms"
  end
end