Class: Tail::LogsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tail/logs_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#web_loggerObject (readonly)

Returns the value of attribute web_logger.



6
7
8
# File 'app/controllers/tail/logs_controller.rb', line 6

def web_logger
  @web_logger
end

Instance Method Details

#flushObject



24
25
26
27
28
# File 'app/controllers/tail/logs_controller.rb', line 24

def flush
  web_logger ||= Tail::Log.instance
  web_logger.flush(params[:file_name])
  redirect_to action: :index
end

#grepObject



12
13
14
15
# File 'app/controllers/tail/logs_controller.rb', line 12

def grep
  @files = tail
  render '_main'
end

#indexObject



8
9
10
# File 'app/controllers/tail/logs_controller.rb', line 8

def index
  @files = tail
end

#tailObject



17
18
19
20
21
22
23
# File 'app/controllers/tail/logs_controller.rb', line 17

def tail
  @web_logger ||= Tail::Log.instance
  @web_logger.n = params[:n]
  params[:n] = @web_logger.n
  log_file_name = params[:file_name] || "#{Rails.env}.log"
  @web_logger.tail(log_file_name)
end