Class: ActionMessenger::LogSubscriber

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

Instance Method Summary collapse

Instance Method Details

#deliver_now!(event) ⇒ Object



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

def deliver_now!(event)
  info do
    "#{Time.current} Sent Message (#{event.duration.round(1)}ms) #{event.payload.as_json}"
  end
end

#loggerObject



24
25
26
# File 'lib/action_messenger/log_subscriber.rb', line 24

def logger
  ActionMessenger::Base.logger
end

#message_to_slack(event) ⇒ Object



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

def message_to_slack(event)
  info do
    "#{Time.current} Sent Message to Slack (#{event.duration.round(1)}ms) #{event.payload.as_json}"
  end
end

#upload_file_to_slack(event) ⇒ Object



18
19
20
21
22
# File 'lib/action_messenger/log_subscriber.rb', line 18

def upload_file_to_slack(event)
  info do
    "#{Time.current} Upload File to Slack (#{event.duration.round(1)}ms) #{event.payload.as_json}"
  end
end