Class: TailLogController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/tail_log_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
8
9
# File 'app/controllers/tail_log_controller.rb', line 2

def index
	@lines = params[:lines] ||= 100
	@stage = (params[:stage] ||= "development") + ".log"
	@file = "#{Rails.root}/log/#{@stage}"
	@command = "tail -n #{@lines} #{@file}"
	@output = `#{@command}`
  render :text => "<code>#{@output.gsub("\n","<br/>")} </code>"
end