<% begin %> <% raise RuntimeError, "Tailog.log_path is not present!" unless Tailog.log_path %> <% if params[:file] %> <% file_path = File.join Tailog.log_path, params[:file] %> <% File.open file_path do |file| %>
<%= erb :'logs/list', locals: { file: file.tail(100).join("\n") } %>
<% end %> <% else %> <% Dir[File.join Tailog.log_path, '**/*.log'].each do |file| %> <% relative_file = Pathname.new(file).relative_path_from(Pathname.new(Tailog.log_path)) %> <%= file %> <% end %> <% end %> <% rescue => error %> <%= erb :error, locals: { error: error }, layout: false %> <% end %>