Class: Dexter::StderrLogParser
- Defined in:
- lib/dexter/parsers/stderr_log_parser.rb
Constant Summary collapse
- LINE_SEPERATOR =
": ".freeze
- DETAIL_LINE =
"DETAIL: ".freeze
Constants inherited from LogParser
Instance Method Summary collapse
Methods inherited from LogParser
Constructor Details
This class inherits a constructor from Dexter::LogParser
Instance Method Details
#perform(collector) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dexter/parsers/stderr_log_parser.rb', line 6 def perform(collector) active_line = nil duration = nil @logfile.each_line 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) collector.add(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 collector.add(active_line, duration) if active_line end |