Class: Com::LogController

Inherits:
BaseController show all
Defined in:
app/controllers/com/log_controller.rb

Constant Summary

Constants included from RailsCom::Application

RailsCom::Application::LOCALE_MAP

Instance Method Summary collapse

Methods included from RailsCom::Application

#current_title, #default_form_params, #default_params, #json_format?, #set_country, #set_flash, #set_locale, #set_timezone, #set_variant

Instance Method Details

#cspObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/com/log_controller.rb', line 12

def csp
  data = JSON.parse(request.body.read)
  p = data.fetch('csp-report', {})
  p.transform_keys!(&:underscore)

  LogCsp.create(p)

  head :no_content
end

#indexObject



22
23
24
25
26
27
# File 'app/controllers/com/log_controller.rb', line 22

def index
  path = Rails.root + RailsCom.config.not_found_logger.instance_variable_get(:@logdev).filename
  result = `tail -n200 #{path}`

  render plain: result
end

#not_foundObject



5
6
7
8
9
10
# File 'app/controllers/com/log_controller.rb', line 5

def not_found
  params.permit!
  RailsCom.config.not_found_logger.info "#{params[:path]}.#{params[:format]}"

  head :not_found
end