Class: Logs::LogsController
Constant Summary
Concerns::Pagination::PAGE, Concerns::Pagination::PER_PAGE
Instance Method Summary
collapse
#download_log_path, #lines, #log_file, #log_file_path, #tail_log_path
Instance Method Details
#download ⇒ Object
16
17
18
19
|
# File 'app/controllers/logs/logs_controller.rb', line 16
def download
file_name = params[:f]
send_file Logs::Viewer.log_path(file_name)
end
|
#index ⇒ Object
12
|
# File 'app/controllers/logs/logs_controller.rb', line 12
def index; end
|
#show ⇒ Object
14
|
# File 'app/controllers/logs/logs_controller.rb', line 14
def show; end
|
#tail ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/logs/logs_controller.rb', line 21
def tail
@file_name = params[:f]
log = File.join(Logs::Viewer.log_path(@file_name))
@lines = `tail -500 #{ log }`.split(/\n/)
@lines.reverse!
respond_to do |wants|
wants.html
wants.json{ render(:json => @lines) }
end
end
|