Class: Telegram::Bot::UpdatesController::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/telegram/bot/updates_controller/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#halted_callback(event) ⇒ Object



31
32
33
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 31

def halted_callback(event)
  info { "Filter chain halted at #{event.payload[:filter].inspect}" }
end

#process_action(event) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 17

def process_action(event)
  info do
    payload   = event.payload
    additions = UpdatesController.log_process_action(payload)
    message = "Completed in #{event.duration.round}ms"
    message += " (#{additions.join(' | ')})" if additions.present?
    message
  end
end

#respond_with(event) ⇒ Object



27
28
29
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 27

def respond_with(event)
  info { "Responded with #{event.payload[:type]}" }
end

#start_processing(event) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 9

def start_processing(event)
  info do
    payload = event.payload
    "Processing by #{payload[:controller]}##{payload[:action]}\n" \
      "  Update: #{payload[:update].to_json}"
  end
end