Sha256: 1a48e07db18075adc5bb34b531fd17ed68e9d07d8db932a9da4263ed9fc1ca27

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require_relative './base_controller.rb'

module LogsExplorer
  class LogsController < LogsExplorer::BaseController

    if LogsExplorer.enabled
      def watch; end

      def changes
        @lines = log_file.readlines
        @total_lines = log_file.total_lines
      end

      def download
        send_file log_file.path
      end

      def log_file
        @log_file ||= begin
          item = LogsExplorer.logs.detect {|e| e[:name] == params[:name]}
          LogFile.new(path: "#{::Rails.root}/#{item[:path]}", client_total_lines: params[:client_total_lines])
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logs_explorer-0.1.1 app/controllers/logs_explorer/logs_controller.rb