class CustomActionControllerLogSubscriber

Public Instance Methods

process_action(event) click to toggle source

Статус записывается в лог файл hot_catch_buf_file

# File lib/hot_catch/custom_log_subscribers.rb, line 43
def process_action(event)
  payload   = event.payload
  additions = ActionController::Base.log_process_action(payload)

  status = payload[:status]
  if status.nil? && payload[:exception].present?
    exception_class_name = payload[:exception].first
    status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
  end

  File.open('tmp/hot_catch_buf_file', 'a'){ |file| file.puts "!!!#{status}!!!" }

  info do

    message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms"
    message << " (#{additions.join(" | ")})" unless additions.blank?
    message
  end
end