Class: Dexter::StderrLogParser

Inherits:
LogParser show all
Defined in:
lib/dexter/stderr_log_parser.rb

Direct Known Subclasses

StderrLogTableParser

Constant Summary

Constants inherited from LogParser

LogParser::DETAIL_LINE, LogParser::LINE_SEPERATOR, LogParser::REGEX

Constants included from Logging

Logging::COLOR_CODES

Instance Attribute Summary

Attributes inherited from LogParser

#once

Instance Method Summary collapse

Methods inherited from LogParser

#initialize

Methods included from Logging

#colorize, #log, #output

Constructor Details

This class inherits a constructor from Dexter::LogParser

Instance Method Details

#performObject



3
4
5
# File 'lib/dexter/stderr_log_parser.rb', line 3

def perform
  process_stderr(@logfile.each_line)
end

#process_stderr(rows) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dexter/stderr_log_parser.rb', line 7

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