Sha256: 155f360d374e85bcc74535400f178518f804ccd5a463f877bc6aafed10fc74be

Contents?: true

Size: 840 Bytes

Versions: 6

Compression:

Stored size: 840 Bytes

Contents

module Dexter
  class StderrLogParser < LogParser
    LINE_SEPERATOR = ":  ".freeze
    DETAIL_LINE = "DETAIL:  ".freeze

    def perform
      process_stderr(@logfile.each_line)
    end

    def process_stderr(rows)
      active_line = nil
      duration = nil

      rows.each do |line|
        if active_line
          if line.include?(DETAIL_LINE)
            add_parameters(active_line, line.chomp.split(DETAIL_LINE)[1])
          elsif line.include?(LINE_SEPERATOR)
            process_entry(active_line, duration)
            active_line = nil
          else
            active_line << line
          end
        end

        if !active_line && (m = REGEX.match(line.chomp))
          duration = m[1].to_f
          active_line = m[3]
        end
      end
      process_entry(active_line, duration) if active_line
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pgdexter-0.5.5 lib/dexter/stderr_log_parser.rb
pgdexter-0.5.4 lib/dexter/stderr_log_parser.rb
pgdexter-0.5.3 lib/dexter/stderr_log_parser.rb
pgdexter-0.5.2 lib/dexter/stderr_log_parser.rb
pgdexter-0.5.1 lib/dexter/stderr_log_parser.rb
pgdexter-0.5.0 lib/dexter/stderr_log_parser.rb