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



29
30
31
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 29

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

#process_action(event) ⇒ Object



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

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



25
26
27
# File 'lib/telegram/bot/updates_controller/log_subscriber.rb', line 25

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

#start_processing(event) ⇒ Object



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

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