Sha256: e236892b15a45311709da5f6cfa02662e4b899c2df85a501376687f6eb8a90b9

Contents?: true

Size: 858 Bytes

Versions: 9

Compression:

Stored size: 858 Bytes

Contents

module RequestLogAnalyzer::Aggregator

  # Echo Aggregator. Writes everything to the screen when it is passed to this aggregator
  class Echo < Base

    attr_accessor :warnings

    def prepare
      @warnings = []
    end

    # Display every parsed line immediately to the terminal
    def aggregate(request)
      puts "\nRequest: \n" + request.lines.map { |l| 
        "\t#{l[:lineno]}:#{l[:line_type]}: #{l.reject { |(k,_)| [:lineno, :line_type].include?(k) }.inspect}" }.join("\n")
    end

    # Capture all warnings during parsing
    def warning(type, message, lineno)
      @warnings << "WARNING #{type.inspect} on line #{lineno}: #{message}"
    end

    # Display every warning in the report when finished parsing
    def report(output)
      output.title("Warnings during parsing")
      @warnings.each { |w| output.puts(w) }
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
request-log-analyzer-1.13.1 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.13.0 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.11 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.10 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.9 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.8 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.7 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.6 lib/request_log_analyzer/aggregator/echo.rb
request-log-analyzer-1.12.5 lib/request_log_analyzer/aggregator/echo.rb